473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

HttpWebRequest 410 Status Code - Username + Password are correct

Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc. I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've already
spent more than a week researching this one issue to no avail. Please help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required

Nov 19 '05 #1
8 3602
Hi Noel,

It looks at first glance that you are attempting Windows Authentication?
The response from the server wants BASIC authentication which is very
different as the username and password are just passed in as clear text
encoded in base64 to the web server. You may want to do a search on Google
for HTTP headers and WWW-Authenticate to see exactly how it works in basic
mode and see how you will need to send headers to the server in order to
authenticate.

Alex

"Noel Volin" <Noel Vo***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS
for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp
executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc.
I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've
already
spent more than a week researching this one issue to no avail. Please
help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required

Nov 19 '05 #2
Hi Noel,

It looks at first glance that you are attempting Windows Authentication?
The response from the server wants BASIC authentication which is very
different as the username and password are just passed in as clear text
encoded in base64 to the web server. You may want to do a search on Google
for HTTP headers and WWW-Authenticate to see exactly how it works in basic
mode and see how you will need to send headers to the server in order to
authenticate.

Alex

"Noel Volin" <Noel Vo***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS
for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp
executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc.
I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've
already
spent more than a week researching this one issue to no avail. Please
help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required

Nov 19 '05 #3
"=?Utf-8?B?Tm9lbCBWb2xpbg==?=" <Noel
Vo***@discussions.microsoft.com> wrote in
news:1B**********************************@microsof t.com:
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code
provided in VS for the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSy
stemNetAuthenticationManagerClassTopic.htm ). I have also
download and tried to use the following CsharpHttp executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set
PreAuthenticate to true, it doesn't matter if I set Keep-Alive
to true, etc., etc., etc. I can log into the website through IE
with my username/password, but setting the credentials just
won't fly. I used to use a simple OpenUrl in VB and that has no
problem. I was hoping to move up in the world, but I've already
spent more than a week researching this one issue to no avail.
Please help.


Check out this blog entry to see what happens at the HTTP level when
using NTLM authentication in a web browser:

http://www.codinghorror.com/blog/archives/000263.html

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 19 '05 #4
"=?Utf-8?B?Tm9lbCBWb2xpbg==?=" <Noel
Vo***@discussions.microsoft.com> wrote in
news:1B**********************************@microsof t.com:
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code
provided in VS for the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSy
stemNetAuthenticationManagerClassTopic.htm ). I have also
download and tried to use the following CsharpHttp executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set
PreAuthenticate to true, it doesn't matter if I set Keep-Alive
to true, etc., etc., etc. I can log into the website through IE
with my username/password, but setting the credentials just
won't fly. I used to use a simple OpenUrl in VB and that has no
problem. I was hoping to move up in the world, but I've already
spent more than a week researching this one issue to no avail.
Please help.


Check out this blog entry to see what happens at the HTTP level when
using NTLM authentication in a web browser:

http://www.codinghorror.com/blog/archives/000263.html

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 19 '05 #5
Alex,
Thanks for your response, but accorging to MSDN:

"The proxy's preauthenticate property can be set to true or false. Set it
to true (as shown in the above code) to supply specific authentication
credentials to cause a WWW-Authenticate HTTP header to be passed with the
initial request. This stops the Web server denying access on the initial
request, and performing authentication on the subsequent request."

I have tried many times setting the property, with no avail. Also, the
NetworkCredential constructor that I am using should be automatically setting
the username and password to Base64 encoded. I certain there is something
very basic that I have overlooked and I will continue to look into your
suggestion to make sure I have fully understood. Please let me know if you
can think of anything else.

Thank you,

Noel Volin

"Alex Passos" wrote:
Hi Noel,

It looks at first glance that you are attempting Windows Authentication?
The response from the server wants BASIC authentication which is very
different as the username and password are just passed in as clear text
encoded in base64 to the web server. You may want to do a search on Google
for HTTP headers and WWW-Authenticate to see exactly how it works in basic
mode and see how you will need to send headers to the server in order to
authenticate.

Alex

"Noel Volin" <Noel Vo***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS
for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp
executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc.
I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've
already
spent more than a week researching this one issue to no avail. Please
help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required


Nov 19 '05 #6
Alex,
Thanks for your response, but accorging to MSDN:

"The proxy's preauthenticate property can be set to true or false. Set it
to true (as shown in the above code) to supply specific authentication
credentials to cause a WWW-Authenticate HTTP header to be passed with the
initial request. This stops the Web server denying access on the initial
request, and performing authentication on the subsequent request."

I have tried many times setting the property, with no avail. Also, the
NetworkCredential constructor that I am using should be automatically setting
the username and password to Base64 encoded. I certain there is something
very basic that I have overlooked and I will continue to look into your
suggestion to make sure I have fully understood. Please let me know if you
can think of anything else.

Thank you,

Noel Volin

"Alex Passos" wrote:
Hi Noel,

It looks at first glance that you are attempting Windows Authentication?
The response from the server wants BASIC authentication which is very
different as the username and password are just passed in as clear text
encoded in base64 to the web server. You may want to do a search on Google
for HTTP headers and WWW-Authenticate to see exactly how it works in basic
mode and see how you will need to send headers to the server in order to
authenticate.

Alex

"Noel Volin" <Noel Vo***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS
for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp
executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc.
I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've
already
spent more than a week researching this one issue to no avail. Please
help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required


Nov 19 '05 #7
Reader Helper:

I have managed to get things to this point:

Headers: Date: Fri, 15 Apr 2005 15:35:17 GMT
Server: IBM-HTTP-Server/1.0
Set-Cookie: inetmmr=97686282.44070.0000; expires=Fri, 15-Apr-2005 18:35:17
GMT;
path=/,JSESSIONID=0000CJVQT3NKR5LCDI1QARKHU2A:vlpo57ja;P ath=/
Accept-Ranges: bytes
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 12
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Cache-Control: no-cache="set-cookie,set-cookie2"
Content-Language: en
Via: 1.1 www.manheim.com
X-Cache: MISS from www.manheim.com
Connection: close

Authentication Failed, InternalServerError
Status Code: 500
Status Description: Internal Server Error
Although, I am not certain as to why I am getting the 500 Error. Anyone
have any ideas?? I've set the cookie container on the HttpWebRequest,
however, the exception still hits on the HttpWebResponse. I have set the
AllowAutoRedirect = true.

All suggestions welcomed.

Thank you,

Noel Volin

"Noel Volin" wrote:
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc. I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've already
spent more than a week researching this one issue to no avail. Please help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required

Nov 19 '05 #8
Persistence is the most productive quality!

I have solved my issue. For those experiencing the same, the root of the
problem resided in the lackin of HttpWebRequest.Accept:

myWebRequest.Accept = @"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*";

Thanks to everyone who so kindly responded to my problem/issue.

Noel Volin
"Noel Volin" wrote:
Anyone who can help here is much appreciated. I am trying to
programmatically log onto a website. I am using the code provided in VS for
the AuthenticationManager Class example (
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm
). I have also download and tried to use the following CsharpHttp executable
in an attempt to find my problem:
http://support.microsoft.com/default...b;en-us;303436

Nothing seems to want to work. It doesn't matter if I set PreAuthenticate
to true, it doesn't matter if I set Keep-Alive to true, etc., etc., etc. I
can log into the website through IE with my username/password, but setting
the credentials just won't fly. I used to use a simple OpenUrl in VB and
that has no problem. I was hoping to move up in the world, but I've already
spent more than a week researching this one issue to no avail. Please help.

Here's what I get back:
The following authentication modules are now registered with the system:

Module : System.Net.DigestClient
CanPreAuthenticate : True

Module : System.Net.NegotiateClient
CanPreAuthenticate : True

Module : System.Net.KerberosClient
CanPreAuthenticate : True

Module : System.Net.NtlmClient
CanPreAuthenticate : True

Module : Mssc.Services.Authentication.CustomBasic
CanPreAuthenticate : False

Headers: Date: Thu, 14 Apr 2005 21:38:52 GMT
Server: Apache/1.3.26 (Unix) mod_macro/1.1.2 mod_perl/1.24
WWW-Authenticate: Basic realm="Welcome to Manheim Online"
Last-Modified: Fri, 07 Feb 2003 16:27:50 GMT
ETag: "5ec1c4-ee-3e43de86"
Accept-Ranges: bytes
Content-Length: 238
Connection: close
Content-Type: text/html

Authentication Failed, Unauthorized
Status Code: 401
Status Description: Authorization Required

Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: buran | last post by:
Dear ASP.NET Programmers, How can I post data to an ASP.NET login page and pass authentication? The login page uses forms authentication, users must supply usernames and password and have to...
0
by: Noel Volin | last post by:
Anyone who can help here is much appreciated. I am trying to programmatically log onto a website. I am using the code provided in VS for the AuthenticationManager Class example (...
1
by: Imran Aziz | last post by:
Hello All, I am using HttpWebRequest to fetch webpages in my ASP.net C# application. The request works fine without the proxy, but on using the code from within a network that uses proxy the...
4
by: Shannon Hardin | last post by:
I'm trying to build a routine that will take a specified file from the user's local hard drive, and copy it to a remote server via WebDAV. I've tried using both HttpWebRequest and FileWebRequest,...
0
by: Elvandar | last post by:
<p> Hi all. I've a web application running under tomcat 5.0.28. Sometimes, after a couple of days of 24h running of the server, suddenly it becames impossibile to log in the application, until...
0
by: barrybevel | last post by:
Hi, I'm trying to login to the www.vodafone.ie website using HttpWebRequest. It works fine with IE/Firefox and the .NET Web Control too, just not with my code. I think it's a redirect 302...
2
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi I have a utility class, called MailHandler, that I wrote to read and operate on emails on an Exchange server using WebDAV. The WebDAV SQL statements are sent using an HttpWebRequest object....
0
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team is experiencing a problem when trying to access a WebService using SSL and through a proxy server after using the HttpWebRequest object. Under normal circumstances we are able to...
1
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.