Alex
Alex

Reputation: 53

401 when POSTing using HttpWebRequest (yes I used Credentials)

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!

Upvotes: 4

Views: 4924

Answers (1)

Farley Knight
Farley Knight

Reputation: 1793

Try setting the header manually:

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

Upvotes: 6

Related Questions