A Microsoft platform for building and publishing apps for Windows devices.
Hello,
Welcome to Microsoft Q&A!
I've checked the code that you shared. The behavior you got is expected. You are using InternetGetCookieA function, InternetSetCookieA function and InternetSetOptionA function in your app. But all these methods as well as their extended method are available only for desktop apps. It means you can't use that in a UWP application. That's why you get exceptions in the release mode.
If you want to use these APIs in your UWP app, what you could do is create a console application and call these APIs from the console application. Then package the console app together with the UWP application via desktop bridge. You could search for UWP with Desktop Extension – Part 1 -stefanwick on the search engine to find a blog. It contains a tutorial about how to implement the desktop bridge.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.