[C#] HttpWebRequest not sending Cookies on Windows Phone

Had a similar problem to Jeroen Swart to do with Cookies in Windows Phone as he mentioned in his blog post here.

Basically identical C# code to make a HttpWebRequest with a few cookies would work in a simple desktop app but no cookies would be sent at all in Windows Phone.

My code to add cookies to a CookieContainer:

cookies.Add(new Uri("https://alexanderhoughton.co.uk/"), new Cookie("TestCookie", "TestCookieValue", "/", "alexanderhoughton.co.uk"));

The fix was to remove the path and domain strings from the Cookie constructor! As Jeroen mentioned in his blog, it’s something to do with the ‘.’ prefix etc.

Working Code:

cookies.Add(new Uri("https://alexanderhoughton.co.uk/"), new Cookie("TestCookie", "TestCookieValue"));

Cookies now are sent successfully.

4 responses to “[C#] HttpWebRequest not sending Cookies on Windows Phone”

  1. Just logged into evotaya777casinologin and everything went smooth. Seems legit, worth a look for the login experience alone. You can check it out here: evotaya777casinologin

  2. Hit up gamevip88 the other day. Had a good run. Lots of options and some unique games you don’t see everywhere. Worth a look if you’re bored with the usual stuff. You can visit them here: gamevip88.

  3. 8casinocomapp. The mobile app runs pretty smooth – makes it easy to play on the run. I played some Baccarat. Give it a try. Download the app here: 8casinocomapp.

Leave a Reply

Your email address will not be published. Required fields are marked *