我想将用户代理设置为Windows Phone 8.1 webview。我使用外部" Dll"但在发布到商店时,其认证过程失败请帮助。
答案 0 :(得分:0)
[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("https://basquang.wordpress.com/2014/04/26/wp8-1-changing-windows-phone-8-1-webview-default-user-agent-in-all-outbound-http-requests/", UriKind.Absolute));
}
Chek here