Re: 401 Error using HttpWebRequest in .NET

From: Stefan Cuypers (stefan.cuypers_at_nospam.postalias)
Date: 04/27/05

  • Next message: PMarino: "Switching from Integrated Authentication to Anonymous"
    Date: Wed, 27 Apr 2005 23:47:39 +0200
    
    

    Ryan,

    You might try to disable the loopback test in Windows 2003SP1. This helped
    for me for a similar behaviour.
    For details see Microsoft KB896861 at
    http://support.microsoft.com/default.aspx?scid=kb;en-us;896861

    Stefan.

    <Ryan.Melena@gmail.com> wrote in message
    news:1114615605.221290.177140@g14g2000cwa.googlegroups.com...
    > Hello all,
    >
    > I'm experiencing a very sporadic error since our company upgraded our
    > intranet server to IIS6 (win2k3 sp1). The problem is stemming from an
    > HttpWebRequest made in one of my .NET applications which is attempting
    > to include the contents of a web page in an email. I have attempted
    > sending credentials in different ways as shown below (both of which
    > worked without problem on IIS5 and win2k):
    >
    > <CODE>
    > HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url);
    > webRequest.PreAuthenticate = true;
    >
    > // Way 1:
    > webRequest.Credentials = CredentialCache.DefaultCredentials;
    >
    > // Way 2:
    > webRequest.Credentials = new
    > NetworkCredential("username","password","domain");
    >
    > HttpWebResponse webResponse =
    > (HttpWebResponse)webRequest.GetResponse();
    > StreamReader sr = new StreamReader(webResponse.GetResponseStream());
    > </CODE>
    >
    > In both cases many requests are successful and the e-mail is sent
    > without a hitch. Other times, however, the request fails with a 401
    > error and an exception is thrown. Examples of the log file for each
    > case are shown below (HttpWebRequests followed by POST of page making
    > the request).
    >
    > <SUCCESS>
    > 2005-04-27 13:32:51 172.22.2.42 GET
    > /Apps/JobCreate/jobdetails_popup.aspx jobid=3030 80 - 172.22.2.42 - 401
    > 2 2148074254
    > 2005-04-27 13:32:51 172.22.2.42 GET
    > /Apps/JobCreate/jobdetails_popup.aspx jobid=3030 80 EGAN\rjm
    > 172.22.2.42 - 200 0 0
    > 2005-04-27 13:32:51 172.22.2.42 POST /Apps/JobCreate/index.aspx - 80
    > EGAN\gdp 172.22.2.104
    > Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+.NET+CLR+1.1.4322)
    > 200 0 0
    > </SUCCESS>
    >
    > <FAILURE>
    > 2005-04-27 14:58:22 172.22.2.42 GET
    > /Apps/JobCreate/jobdetails_popup.aspx jobid=3033 80 - 172.22.2.42 - 401
    > 1 0
    > 2005-04-27 14:58:22 172.22.2.42 GET
    > /Apps/JobCreate/jobdetails_popup.aspx jobid=3033 80 - 172.22.2.42 - 401
    > 1 2148074252
    > 2005-04-27 14:58:22 172.22.2.42 POST /Apps/JobCreate/index.aspx - 80
    > EGAN\sks 172.22.4.116
    > Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0) 200 0 0
    > </FAILUR>
    >
    > As can be seen from the log file, the same page is being requested in
    > every case (with only a different parameter in the URL). There are no
    > errors on the page being requested as it can be visited directly
    > without a problem.
    >
    > The IIS Application is set to allow Integrated Windows Authentication
    > only (because I need to grab the user's login name for other purposes).
    >
    > The problem does not seem to be linked to any particular user or
    > computer which is the thing that is really confusing me. It seems to
    > happen almost at random.
    >
    > Any help that anyone could offer would be greatly apprecaited!
    >
    > Thank you,
    > Ryan
    >


  • Next message: PMarino: "Switching from Integrated Authentication to Anonymous"

    Relevant Pages

    • Re: Windows Server Referral Problem
      ... EN> Markus I have a request out to Microsoft to get more information ... When Windows ... and returns a referral to the specified realm if there's a match. ... EN> I have a problem with server referrals in my Windows environment. ...
      (comp.protocols.kerberos)
    • IPSEC with certificates on Windows XP (Certificate donīt have a private key )
      ... I have a question for the Microsoft CSP and IPSEC. ... I have installed a small network of 4 computers. ... computers and two windows 2000 computers. ... The program certreq.exe generate a certificate request. ...
      (microsoft.public.platformsdk.security)
    • Re: call is blocked in recvfrom() and no further proceedings in Wi
      ... For transmitting UDP packets through emulator, ... >> In windows CE, I'm able to send a request but I'm unable to receive it. ... >>> My program has to send request to service through port 5070(in this port ...
      (microsoft.public.windowsce.embedded)
    • .net user permissions in IIS
      ... We have a windows 2003 domain with 4 web servers in. ... (Exception from HRESULT: 0x80070005 ... the current web request. ...
      (microsoft.public.dotnet.framework.aspnet)
    • [NT] Invalid Universal Plug and Play Request Can Disrupt System Operation
      ... Invalid Universal Plug and Play Request Can Disrupt System Operation ... Windows ME and XP include native UPnP ... manufacturers do, however, install it on the systems they sell) ...
      (Securiteam)