views:

797

answers:

2

I'm getting this error... What is puzzling me is the fact that i do not have any type of security enabled for the page i'm invoking...

WebClient myWebClient = new WebClient();
myWebClient.UploadData(myUrl,"POST", myByteArray);

When i access directly to the page ( on ie ) it works fine, with the WebClient it's not working.

Anyone has a clue on what can be wrong?

+1  A: 

IE supports integrated security, which will use your current login credentials as the username and password, so you don't have to manually enter it.

If you are using IE, use Firefox and see if you are prompted for a username and password. Or, in IE, you can go to Tools, Options, Advanced, and uncheck Integrated Windows Authentication.

Most likely, you'll have to configure the web application to support anonymous access, or you'll have to implement security in your WebClient.

ericp
Touché :) I was missing the anonymous access permission. Thanks :)
Sergio
+1  A: 

If you are struggling to get to the bottom of it Fiddler might shed some light. You will have to manually edit your code to go through the Fiddler proxy, but once that's done you can compare the IE result to the code one.

Steven Robbins