473,394 Members | 1,773 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,394 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 3605
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.