Developer Forum [ All Topics | New Topic ]

Thread: Error 401 attampting to authenticate

I get the following error attampting to get an authentication ticket: An unhandled exception of type 'System.Net.WebException' occurred in system.dll Additional information: The remote server returned an error: (401) Unauthorized. Here is the VB.Net code: Dim URLAuth As String = "https://technet.rapaport.com/HTTP/Authenticate.aspx" Dim webClient As New WebClient Dim formData As New NameValueCollection formData("Username") = "xxxxxxxxxx" formData("Password") = "xxxxxxxxxx" Dim responseBytes As Byte() = webClient.UploadValues(URLAuth, "POST", formData) The Username and Password are valid - when I browse to URLAuth and enter them I get an authorization string. (I tried the C# example on the website and got the same error.) What am I missing? Thanks, Joe Shurpin

>> add a comment
Joe Shurpin
02/03/2010 12:46


3 Replies:

The code looks fine to me (I didn't test though). Do you have any special characters in the password by any chance?

>> add a comment
Leo Muller
2/4/2010 8:26:00 AM
The password does contain a "reserved" character, so I encoded it. I still get the same 401 error. In my download prices program, which does not use the authorization string but rather uses the username/password directly for the download, I have no problems even without encoding the reserved character.

>> add a comment
Joe Shurpin
2/5/2010 1:20:00 AM
Hi I checked our code it is works fine can you please send me your code to samuel@diamonds.net with your username and password? thanks Samuel

>> add a comment
Samuel
2/8/2010 3:33:00 AM