HttpWebRequest and 401

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default HttpWebRequest and 401

    Hello All
    Here is what I am attempting to do:

    I have a NTLM protected site. There are some users who are not part of
    the domain (visitors) get challenged with a Pop up dialog box
    prompting for a user id, pwd and domain.

    In oder to overcome this, I have setup a anonymous site (open to
    alll). Users would first hit this site contains a page with an
    instance of HttpWebRequest class. This class would make a call to the
    protected site with the user's credentials on behalf of the user. If
    the user has the correct credentials, then they would be passed to the
    protected site else they would be redirected to a login page (NOT the
    pop up dialog). In theory this appears to be a good idea to get rid of
    the po up dialog.

    However, I am unable to get the suers credentials on the anonymous
    site and pass it to the HttpWebRequest. If I use DefaultCredentials,
    then the site's user id and password are passed (IUSR_MACHINENAME). Is
    it possible to obtain the user credential on the anonymous site or is
    there another way to acoomplish this

    Thanks
    LinuxLivz Guest

  2. Similar Questions and Discussions

    1. httpwebrequest please help clarify
      I am posting an xml document using httpwebrequest post method using a x509certificate, my question is this, is this secure if I am posting to an...
    2. HttpWebRequest and HttpWebResponse
      Hi all: My old application used to POST xml to a remote server using HttpWebRequest from within an aspx page. The process worked like a charm...
    3. HTTPWebRequest
      Well, here's the scenario: In your base app, the user's credentials are verified. If the rest of those apps "hang under" the base app, then you...
    4. How to authenticate HttpWebRequest?
      Hi, i have a protected part of application ("security" subdirectory is protected by authentication mode="Forms"). i'd like to give a user a...
    5. HttpWebRequest is not posting
      Hi All, I have an HttpWebRequest object that is supposed to post data to a web page. The server is receiving the data, and I am getting an OK...
  3. #2

    Default RE: HttpWebRequest and 401

    I think you're confusing authentication types.

    Read this msdn article, "IIS Authentication" on the subject or search
    online on msdn.
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vsent7/html/vxconIISAuthentic
    ation.htm

    At some point, you will need to gather authentication information from the
    user (i.e. they will have to enter a username / pwd). Why use two servers
    when one will suffice?


    --------------------------------------------------------------------
    This reply is provided AS IS, without warranty (express or implied).


    --------------------
    >From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    >Subject: HttpWebRequest and 401
    >Date: 29 Jan 2004 06:35:21 -0800
    >Organization: [url]http://groups.google.com[/url]
    >Lines: 23
    >Message-ID: <a5921448.0401290635.240f1498@posting.google.com >
    >NNTP-Posting-Host: 63.100.172.7
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1075386921 4534 127.0.0.1 (29 Jan 2004
    14:35:21 GMT)
    >X-Complaints-To: [email]groups-abuse@google.com[/email]
    >NNTP-Posting-Date: Thu, 29 Jan 2004 14:35:21 +0000 (UTC)
    >Path:
    cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.su
    l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
    stnews1.google.com!not-for-mail
    >Xref: cpmsftngxa07.phx.gbl
    microsoft.public.dotnet.framework.aspnet.security: 8423
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    >
    >Hello All
    >Here is what I am attempting to do:
    >
    >I have a NTLM protected site. There are some users who are not part of
    >the domain (visitors) get challenged with a Pop up dialog box
    >prompting for a user id, pwd and domain.
    >
    >In oder to overcome this, I have setup a anonymous site (open to
    >alll). Users would first hit this site contains a page with an
    >instance of HttpWebRequest class. This class would make a call to the
    >protected site with the user's credentials on behalf of the user. If
    >the user has the correct credentials, then they would be passed to the
    >protected site else they would be redirected to a login page (NOT the
    >pop up dialog). In theory this appears to be a good idea to get rid of
    >the po up dialog.
    >
    >However, I am unable to get the suers credentials on the anonymous
    >site and pass it to the HttpWebRequest. If I use DefaultCredentials,
    >then the site's user id and password are passed (IUSR_MACHINENAME). Is
    >it possible to obtain the user credential on the anonymous site or is
    >there another way to acoomplish this
    >
    >Thanks
    >
    Charlie Nilsson [MSFT] Guest

  4. #3

    Default Re: HttpWebRequest and 401

    [email]CharlieNilsson_CUTOUT_@hotmail.com[/email] (Charlie Nilsson [MSFT]) wrote in message news:<ngZS9Bp5DHA.1992@cpmsftngxa07.phx.gbl>...
    > I think you're confusing authentication types.
    >
    > Read this msdn article, "IIS Authentication" on the subject or search
    > online on msdn.
    > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vsent7/html/vxconIISAuthentic
    > ation.htm
    >
    > At some point, you will need to gather authentication information from the
    > user (i.e. they will have to enter a username / pwd). Why use two servers
    > when one will suffice?
    >
    >
    > --------------------------------------------------------------------
    > This reply is provided AS IS, without warranty (express or implied).
    >
    >
    > --------------------
    > >From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    > >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    > >Subject: HttpWebRequest and 401
    > >Date: 29 Jan 2004 06:35:21 -0800
    > >Organization: [url]http://groups.google.com[/url]
    > >Lines: 23
    > >Message-ID: <a5921448.0401290635.240f1498@posting.google.com >
    > >NNTP-Posting-Host: 63.100.172.7
    > >Content-Type: text/plain; charset=ISO-8859-1
    > >Content-Transfer-Encoding: 8bit
    > >X-Trace: posting.google.com 1075386921 4534 127.0.0.1 (29 Jan 2004
    > 14:35:21 GMT)
    > >X-Complaints-To: [email]groups-abuse@google.com[/email]
    > >NNTP-Posting-Date: Thu, 29 Jan 2004 14:35:21 +0000 (UTC)
    > >Path:
    > cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.su
    > l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
    > stnews1.google.com!not-for-mail
    > >Xref: cpmsftngxa07.phx.gbl
    > microsoft.public.dotnet.framework.aspnet.security: 8423
    > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    > >
    > >Hello All
    > >Here is what I am attempting to do:
    > >
    > >I have a NTLM protected site. There are some users who are not part of
    > >the domain (visitors) get challenged with a Pop up dialog box
    > >prompting for a user id, pwd and domain.
    > >
    > >In oder to overcome this, I have setup a anonymous site (open to
    > >alll). Users would first hit this site contains a page with an
    > >instance of HttpWebRequest class. This class would make a call to the
    > >protected site with the user's credentials on behalf of the user. If
    > >the user has the correct credentials, then they would be passed to the
    > >protected site else they would be redirected to a login page (NOT the
    > >pop up dialog). In theory this appears to be a good idea to get rid of
    > >the po up dialog.
    > >
    > >However, I am unable to get the suers credentials on the anonymous
    > >site and pass it to the HttpWebRequest. If I use DefaultCredentials,
    > >then the site's user id and password are passed (IUSR_MACHINENAME). Is
    > >it possible to obtain the user credential on the anonymous site or is
    > >there another way to acoomplish this
    > >
    > >Thanks
    > >

    Thanks for your response. I understand auth types, NTLM works well for
    windows domain acounts, what about other OSes? The thinking is to
    perform auth without the annoyin pop-up dialog. I think, to condense
    the question, it would be can one make the auth pop up dialog go away
    if user is not in a Windows domain

    Thaks
    LinuxLivz Guest

  5. #4

    Default Re: HttpWebRequest and 401


    Right, Linux machines do not support NTLM natively (though Mozilla *was*
    trying to get it to function properly, though I don't think they're working
    on that anymore). I'm unaware of any method for getting your Linux
    clients to send authentication info along with the HTTP request to IIS (or
    respond with the user's correct Windows Domain credentials during challenge
    / response).
    I'm afraid you'll have to re-think your security settings in IIS.


    --
    CharlieN
    VSU

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Note: For the benefit of the community-at-large, all responses to this
    message are best directed to the newsgroup/thread from which they
    originated.

    --------------------
    > From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    > Subject: Re: HttpWebRequest and 401
    > Date: 29 Jan 2004 14:39:35 -0800
    > Organization: [url]http://groups.google.com[/url]
    > Lines: 73
    > Message-ID: <a5921448.0401291439.4f906760@posting.google.com >
    > References: <a5921448.0401290635.240f1498@posting.google.com >
    <ngZS9Bp5DHA.1992@cpmsftngxa07.phx.gbl>
    > NNTP-Posting-Host: 63.100.172.7
    > Content-Type: text/plain; charset=ISO-8859-1
    > Content-Transfer-Encoding: 8bit
    > X-Trace: posting.google.com 1075415976 7022 127.0.0.1 (29 Jan 2004
    22:39:36 GMT)
    > X-Complaints-To: [email]groups-abuse@google.com[/email]
    > NNTP-Posting-Date: Thu, 29 Jan 2004 22:39:36 +0000 (UTC)
    > Path:
    cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!cpmsftng xa08.phx.gbl!cpmsftngxa06.
    phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl! newsfeed00.sul.t-online.de
    !t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.googl
    e.com!not-for-mail
    > Xref: cpmsftngxa07.phx.gbl
    microsoft.public.dotnet.framework.aspnet.security: 8438
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    >
    > [email]CharlieNilsson_CUTOUT_@hotmail.com[/email] (Charlie Nilsson [MSFT]) wrote in
    message news:<ngZS9Bp5DHA.1992@cpmsftngxa07.phx.gbl>...
    > > I think you're confusing authentication types.
    > >
    > > Read this msdn article, "IIS Authentication" on the subject or search
    > > online on msdn.
    > >
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vsent7/html/vxconIISAuthentic
    > > ation.htm
    > >
    > > At some point, you will need to gather authentication information from
    the
    > > user (i.e. they will have to enter a username / pwd). Why use two
    servers
    > > when one will suffice?
    > >
    > >
    > > --------------------------------------------------------------------
    > > This reply is provided AS IS, without warranty (express or implied).
    > >
    > >
    > > --------------------
    > > >From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    > > >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    > > >Subject: HttpWebRequest and 401
    > > >Date: 29 Jan 2004 06:35:21 -0800
    > > >Organization: [url]http://groups.google.com[/url]
    > > >Lines: 23
    > > >Message-ID: <a5921448.0401290635.240f1498@posting.google.com >
    > > >NNTP-Posting-Host: 63.100.172.7
    > > >Content-Type: text/plain; charset=ISO-8859-1
    > > >Content-Transfer-Encoding: 8bit
    > > >X-Trace: posting.google.com 1075386921 4534 127.0.0.1 (29 Jan 2004
    > > 14:35:21 GMT)
    > > >X-Complaints-To: [email]groups-abuse@google.com[/email]
    > > >NNTP-Posting-Date: Thu, 29 Jan 2004 14:35:21 +0000 (UTC)
    > > >Path:
    > >
    cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.su
    > >
    l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
    > > stnews1.google.com!not-for-mail
    > > >Xref: cpmsftngxa07.phx.gbl
    > > microsoft.public.dotnet.framework.aspnet.security: 8423
    > > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    > > >
    > > >Hello All
    > > >Here is what I am attempting to do:
    > > >
    > > >I have a NTLM protected site. There are some users who are not part of
    > > >the domain (visitors) get challenged with a Pop up dialog box
    > > >prompting for a user id, pwd and domain.
    > > >
    > > >In oder to overcome this, I have setup a anonymous site (open to
    > > >alll). Users would first hit this site contains a page with an
    > > >instance of HttpWebRequest class. This class would make a call to the
    > > >protected site with the user's credentials on behalf of the user. If
    > > >the user has the correct credentials, then they would be passed to the
    > > >protected site else they would be redirected to a login page (NOT the
    > > >pop up dialog). In theory this appears to be a good idea to get rid of
    > > >the po up dialog.
    > > >
    > > >However, I am unable to get the suers credentials on the anonymous
    > > >site and pass it to the HttpWebRequest. If I use DefaultCredentials,
    > > >then the site's user id and password are passed (IUSR_MACHINENAME). Is
    > > >it possible to obtain the user credential on the anonymous site or is
    > > >there another way to acoomplish this
    > > >
    > > >Thanks
    > > >
    >
    >
    > Thanks for your response. I understand auth types, NTLM works well for
    > windows domain acounts, what about other OSes? The thinking is to
    > perform auth without the annoyin pop-up dialog. I think, to condense
    > the question, it would be can one make the auth pop up dialog go away
    > if user is not in a Windows domain
    >
    > Thaks
    >
    Charlie Nilsson [MSFT] Guest

  6. #5

    Default Re: HttpWebRequest and 401

    You should be able to use Basic authentication (with SSL for safety of
    course). Basic authentication headers are easy to build on just about any
    platform. Plus, you can send them with the original request
    (pre-authenticate) to avoid the challenge/response.

    However, if NTLM/Kerberos is required for the Web Service, then Charlie is
    absolutely right.

    Joe K.

    "Charlie Nilsson [MSFT]" <CharlieNilsson_CUTOUT_@hotmail.com> wrote in
    message news:jg3aZl05DHA.1988@cpmsftngxa07.phx.gbl...
    >
    > Right, Linux machines do not support NTLM natively (though Mozilla *was*
    > trying to get it to function properly, though I don't think they're
    working
    > on that anymore). I'm unaware of any method for getting your Linux
    > clients to send authentication info along with the HTTP request to IIS (or
    > respond with the user's correct Windows Domain credentials during
    challenge
    > / response).
    > I'm afraid you'll have to re-think your security settings in IIS.
    >
    >
    > --
    > CharlieN
    > VSU
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    >
    > Note: For the benefit of the community-at-large, all responses to this
    > message are best directed to the newsgroup/thread from which they
    > originated.
    >
    > --------------------
    > > From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    > > Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    > > Subject: Re: HttpWebRequest and 401
    > > Date: 29 Jan 2004 14:39:35 -0800
    > > Organization: [url]http://groups.google.com[/url]
    > > Lines: 73
    > > Message-ID: <a5921448.0401291439.4f906760@posting.google.com >
    > > References: <a5921448.0401290635.240f1498@posting.google.com >
    > <ngZS9Bp5DHA.1992@cpmsftngxa07.phx.gbl>
    > > NNTP-Posting-Host: 63.100.172.7
    > > Content-Type: text/plain; charset=ISO-8859-1
    > > Content-Transfer-Encoding: 8bit
    > > X-Trace: posting.google.com 1075415976 7022 127.0.0.1 (29 Jan 2004
    > 22:39:36 GMT)
    > > X-Complaints-To: [email]groups-abuse@google.com[/email]
    > > NNTP-Posting-Date: Thu, 29 Jan 2004 22:39:36 +0000 (UTC)
    > > Path:
    >
    cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!cpmsftng xa08.phx.gbl!cpmsftngxa06.
    >
    phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl! newsfeed00.sul.t-online.de
    >
    !t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.googl
    > e.com!not-for-mail
    > > Xref: cpmsftngxa07.phx.gbl
    > microsoft.public.dotnet.framework.aspnet.security: 8438
    > > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    > >
    > > [email]CharlieNilsson_CUTOUT_@hotmail.com[/email] (Charlie Nilsson [MSFT]) wrote in
    > message news:<ngZS9Bp5DHA.1992@cpmsftngxa07.phx.gbl>...
    > > > I think you're confusing authentication types.
    > > >
    > > > Read this msdn article, "IIS Authentication" on the subject or search
    > > > online on msdn.
    > > >
    >
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vsent7/html/vxconIISAuthentic
    > > > ation.htm
    > > >
    > > > At some point, you will need to gather authentication information from
    > the
    > > > user (i.e. they will have to enter a username / pwd). Why use two
    > servers
    > > > when one will suffice?
    > > >
    > > >
    > > > --------------------------------------------------------------------
    > > > This reply is provided AS IS, without warranty (express or implied).
    > > >
    > > >
    > > > --------------------
    > > > >From: [email]linuxlivz@yahoo.com[/email] (LinuxLivz)
    > > > >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    > > > >Subject: HttpWebRequest and 401
    > > > >Date: 29 Jan 2004 06:35:21 -0800
    > > > >Organization: [url]http://groups.google.com[/url]
    > > > >Lines: 23
    > > > >Message-ID: <a5921448.0401290635.240f1498@posting.google.com >
    > > > >NNTP-Posting-Host: 63.100.172.7
    > > > >Content-Type: text/plain; charset=ISO-8859-1
    > > > >Content-Transfer-Encoding: 8bit
    > > > >X-Trace: posting.google.com 1075386921 4534 127.0.0.1 (29 Jan 2004
    > > > 14:35:21 GMT)
    > > > >X-Complaints-To: [email]groups-abuse@google.com[/email]
    > > > >NNTP-Posting-Date: Thu, 29 Jan 2004 14:35:21 +0000 (UTC)
    > > > >Path:
    > > >
    >
    cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.su
    > > >
    >
    l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
    > > > stnews1.google.com!not-for-mail
    > > > >Xref: cpmsftngxa07.phx.gbl
    > > > microsoft.public.dotnet.framework.aspnet.security: 8423
    > > > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    > > > >
    > > > >Hello All
    > > > >Here is what I am attempting to do:
    > > > >
    > > > >I have a NTLM protected site. There are some users who are not part
    of
    > > > >the domain (visitors) get challenged with a Pop up dialog box
    > > > >prompting for a user id, pwd and domain.
    > > > >
    > > > >In oder to overcome this, I have setup a anonymous site (open to
    > > > >alll). Users would first hit this site contains a page with an
    > > > >instance of HttpWebRequest class. This class would make a call to the
    > > > >protected site with the user's credentials on behalf of the user. If
    > > > >the user has the correct credentials, then they would be passed to
    the
    > > > >protected site else they would be redirected to a login page (NOT the
    > > > >pop up dialog). In theory this appears to be a good idea to get rid
    of
    > > > >the po up dialog.
    > > > >
    > > > >However, I am unable to get the suers credentials on the anonymous
    > > > >site and pass it to the HttpWebRequest. If I use DefaultCredentials,
    > > > >then the site's user id and password are passed (IUSR_MACHINENAME).
    Is
    > > > >it possible to obtain the user credential on the anonymous site or is
    > > > >there another way to acoomplish this
    > > > >
    > > > >Thanks
    > > > >
    > >
    > >
    > > Thanks for your response. I understand auth types, NTLM works well for
    > > windows domain acounts, what about other OSes? The thinking is to
    > > perform auth without the annoyin pop-up dialog. I think, to condense
    > > the question, it would be can one make the auth pop up dialog go away
    > > if user is not in a Windows domain
    > >
    > > Thaks
    > >
    >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139