401 Unauthorized on HttpWebRequest with DefaultCredentials (2003)

I

ivarley

Hi all,

In moving an app from server 2000 to server 2003, we started getting
errors from this code. It pulls a page (on the same web server) using a
web request. This is an intranet site, and integrated windows
authentication is turned on. Same exact code works fine on a Windows
2000 server.

The error is: "The remote server returned an error message: 401
Unauthorized". Can anybody point us to what might be configured wrong?

Thanks,
Ian

//--------------------------------------------------
using System.Net;
using System.IO;
//...
private string GetWebPage(string url)
{
HttpWebRequest w = (HttpWebRequest)WebRequest.Create(url);
w.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse r =(HttpWebResponse)w.GetResponse();
StreamReader webstream = new StreamReader(r.GetResponseStream(),
System.Text.Encoding.Default);
//....
}
//--------------------------------------------------
 
I

ivarley

We eventually figured it out ... it was a registry setting having to do
with preventing loopbacks on server 2003, by halting calls to the same
server with a different name. Disabled that, and everything was fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top