basquang™ on clouds

September 28, 2015

UWP: Open Store Rating to request user review and rate from your Windows 10 app

Filed under: UWP,windows 10 — basquang @ 4:32 PM
Tags: , , ,

In Windows Phone 8.x, you can use the Marketplace review task to launch the Store or Marketplace and then display the review page for the current app. The code is simple as below

MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();

Unfortunately, UWP Windows 10 app does not support this kind of Marketplace review task. So the question is “How to open review page for current app to request user to rate your app on Windows 10?” Solution is, you can use Windows.System.Launcher to launch the ms-windows-store: URI scheme. The URI schema to launches the write a review experience for a product for example are:

Product ID: ms-windows-store://review/?ProductId=9WZDNCRFHVJL
Package Family Name (PFN): ms-windows-store://review/?PFN= Microsoft.Office.OneNote_8wekyb3d8bbwe

And then, in your code, using one of the uriString above

await Windows.System.Launcher.LaunchUriAsync(new Uri(uriString));

For Windows app, using the second schema uri is my recommendation, because you can get PFN dynamically from your code by using Windows.ApplicationModel.PackageId.FamilyName
but Windows.ApplicationModel.PackageId.ProductID is only available for Windows Phone app.

Hope this help!


April 26, 2014

[WP8.1]: Changing Windows Phone 8.1 WebView default User-Agent in all outbound HTTP requests

Filed under: Microsoft Technology,Tips,Windows Phone — basquang @ 10:07 AM
Tags: , ,

Recently, I’m developing Windows Phone 8 app which hosting our cloud services. We need to add some custom HTTP Headers in to requests. Unfortunately, Windows Phone 8 WebBrowser control doesn’t have properties to set custom User-Agent by default. The only way you can do is the method:

webBrowser1.Navigate(new Uri("", UriKind.Absolute), 
null, "User-Agent: your custom user-agent");

But with this method, you are able to pass your custom user-agent in first request only. With outbound HTTP request, meaning all web link in your site, the webBrowser1 will using device’s default User-Agent.

You can check your current user-agent here:

By the release of Windows Phone 8.1, now you can set your custom User-Agent for entire process by using Win32 API: UrlMkSetSessionOption

Using following code to make your user-agent by default for all outbound HTTP request in WebView control on Windows Phone 8.1

[DllImport("urlmon.dll", CharSet = CharSet.Ansi)]
private static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved);

const int URLMON_OPTION_USERAGENT = 0x10000001;
public void ChangeUserAgent(string Agent)
      UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, Agent, Agent.Length, 0);

void MainPage_Loaded(object sender, RoutedEventArgs e)
      ChangeUserAgent("My Custom User-Agent");
      wb.Navigate(new Uri("", UriKind.Absolute));

Hope this help!


Create a free website or blog at