0
votes

I want to call the UrlMkSetSessionOption method from the urlmon library in a Windows Phone Silverlight 8.1 application to modify the browser's User Agent string.

Apparently Windows Phone Silverlight doesn't support PInvoke, so I have to create a runtime component instead to call the native C++ method. My Visual Studio 2013 solution looks like this:

1) A Windows Runtime Component (Windows Phone Silverlight 8.1) Project

2) A Windows Phone Silverlight 8.1 Project

Project 2 has a reference added to Project 1

If I compile the solution with a sample "return int" C++ method everything works fine. However, when I #include urlmon.h VS does not recognize the UrlMkSetSessionOption method (please see image below). If I open the urlmon.h file it is there, but somehow VS ignores it.

Could anybody please point me in the right direction to solve this issue? How should I call urlmon.h in a Silverlight Phone App?

Image: https://dl.dropboxusercontent.com/u/90478853/Perm/urlmon.png

1

1 Answers

0
votes

UrlMkSetSessionOption is not supported in Windows Phone or Windows Desktop Store, so no point trying it. You can try to use it by linking to urlmon.dll and run it locally but the certification will fail.