By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,816 Members | 2,053 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,816 IT Pros & Developers. It's quick & easy.

Error "The remote server returned an error: (401) Unauthorized."

P: n/a
I have a folder structure such like this.
A
---A1
-----a1.aspx
---A2
A1 and A2 are the subfolder of A. And under the A1 folder, it contains one
aspx file named a1.aspx. I set the IIS virtual dictionary to A folder. And
IIS has allowed annoymous access.

But when I use following code to access the webpage and I got the error" The
remote server returned an error: (401) Unauthorized."
Here is my client side code:

private static string retrieveFromURL(WebRequest request)
{
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
return reader.ReadToEnd();
}

But if I put the a1.aspx dicrectly under A folder, I will not get this error.
Anyone can help me? Thanks in advance.
Apr 21 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.