views:

1198

answers:

3

I'm using HttpWebRequest to pull down XML, and POST data back to a 'WebService' and getting a 401 on the POST.

When creating the requests I've added Credentials and now tried a credentials cache and setting PreAutenticate to True, still getting the 401! :(

Watching the HTTP traffic on the router I set the get make an unauthenticated GET request.. it hits the 401 and then makes an authenticated GET and is allowed through. When I watch the POST I see it hit the 401... and it doesn't even try an authenticated POST.

This appears only on mobile phones (compact-framework 3.5 and 2.0 on WinMobile 6.1). The same .exe works perfectly on any desktop machines.

What am I missing? Please help!

A: 

I've just been trying to work around this by using cookies, only to find out cookies are not supported by the .Net compact-framework.

Alex
A: 

Did you find a way around this?

Farley Knight
Yes, see the selected answer... FAR from ideal. I'm _really_ disappointed by the CF so far.
Alex
+1  A: 

Try setting the header manually:

http://devproj20.blogspot.com/2008/02/assigning-basic-authorization-http.html

Farley Knight
This is what we ended up doing, it's far from ideal, but seems to be the only workable solution.
Alex
Yes, this works perfect. Just had to do the same thingy.
Vladimir Dyuzhev