401 Unauthorized on HttpWebRequest with DefaultCredentials (2003)

Discussion in 'ASP .Net Security' started by ivarley@spamcop.net, Mar 28, 2006.

  1. Guest

    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);
    //....
    }
    //--------------------------------------------------
     
    , Mar 28, 2006
    #1
    1. Advertising

  2. Guest

    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.
     
    , Mar 31, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UG1jZw==?=

    HttpWebRequest & (401) Unauthorized http status code

    =?Utf-8?B?UG1jZw==?=, Jun 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,411
    =?Utf-8?B?UG1jZw==?=
    Jun 21, 2004
  2. Steve Richter
    Replies:
    2
    Views:
    10,522
    Shane Thomas
    Apr 30, 2005
  3. Jamie
    Replies:
    1
    Views:
    1,100
    Kevin C
    Mar 2, 2004
  4. Rodrigo Estrada

    401 Unauthorized when using DefaultCredentials

    Rodrigo Estrada, May 11, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    221
    Paul Glavich [MVP - ASP.NET]
    May 11, 2004
  5. Bfranknyc

    401 Error on POST using DefaultCredentials

    Bfranknyc, Nov 21, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    880
    Bfranknyc
    Nov 21, 2008
Loading...

Share This Page