Error on httpserver
Error on httpserver
Error on httpserver
Error on httpserver
Error on httpserver
Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver
Error on httpserver Error on httpserver
Error on httpserver
Go Back  Xtreme Visual Basic Talk > > > Error on httpserver


Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2004, 07:31 AM
peanutman's Avatar
peanutman peanutman is offline
Junior Contributor
 
Join Date: Sep 2003
Location: Belgium
Posts: 316
Default Error on httpserver


i'm experimenting with the messenger protocol a bit, therefor i need to log in using pass/username/challenge string on a certain server (url is in Uri) (uri always seems to be https://loginnet.passport.com/login2.srf)

this function should login, but it always gives an error on the line:
Code:
ServerRequest.Headers.Set("Authorization", "Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=" & Replace(sUser, "@", "%40") & ", pwd=" & sPass & "," & strChallenge)

but if i change the value to something else, like "test" or whatever, it works
i just don't know why it has problems with that string...
the error is:
Code:
An unhandled exception of type 'System.ArgumentException' occurred in system.dll Additional information: value

here is the full code:
Code:
Public Function LoginSSL(ByVal sUser As String, ByVal sPass As String, ByVal URi As String, ByVal strChallenge As String) As String Dim ServerRequest As System.Net.HttpWebRequest ServerRequest = System.Net.HttpWebRequest.Create(URi) ServerRequest.Headers.Set("Authorization", "Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=" & Replace(sUser, "@", "%40") & ", pwd=" & sPass & "," & strChallenge) Dim ServerResponse As System.Net.HttpWebResponse = ServerRequest.GetResponse().GetResponse() ServerResponse.Close() Return ServerResponse.Headers.ToString End Function

Reinout,
__________________
http://free-b.org

Last edited by peanutman; 12-05-2004 at 07:36 AM.
Reply With Quote
  #2  
Old 12-05-2004, 07:49 AM
excaliber's Avatar
excaliberError on httpserver excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Couple of things. I turned Option Stric On just to see, and you have a few implicit conversions. Change this line to this:

Code:
Dim ServerRequest As System.Net.HTTPWebRequest 'to Dim ServerRequest As System.Net.WebRequest ' 'and' ' Dim ServerResponse As System.Net.HttpWebResponse = ServerRequest.GetResponse().GetResponse() 'to Dim ServerResponse As System.Net.WebResponse = ServerRequest.GetResponse()

Aside from that (which really won't affect your code any, it just makes .Net happier), I'm not sure what is wrong. That line worked for me when I tried it (granted, I used sPass="test", sUser="test" and strChallente="mychallenge").

What values are you passing into the function? Perhaps the problem lies there.
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #3  
Old 12-05-2004, 08:24 AM
peanutman's Avatar
peanutman peanutman is offline
Junior Contributor
 
Join Date: Sep 2003
Location: Belgium
Posts: 316
Default

thanks, it did help me a lot (but i still didn't solve it)

i did like you did, i tried it by leaving out the variables and putting the info directly into the string.
when i use "test" and stuff it does work (thx for that) and returns a "The remote server returned an error: (401) Unauthorized." which is normal i think.

after a bit of experimenting i found out the error only happens when " & strChallenge" is added

strChallenge is always a string in this format:
"lc=1033,id=507,tw=40,fs=1,ru=http%3A%2F%2Fmessenger%2Emsn%2Ecom,ct=11 02256618,kpp=1,kv=5,ver=2.1.6000.1,tpf=f5e725aac530ece70e1e129c95b2e67 0"

i don't quite see anything wrong with it... or could it be that there's a character in it thats hidden, like a vbCrlf or something that causes the error?
__________________
http://free-b.org
Reply With Quote
  #4  
Old 12-05-2004, 09:20 AM
excaliber's Avatar
excaliberError on httpserver excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

I'm not sure what you have wrong. Here is my slightly edited test version (with my password starred out:

Code:
Dim strchallenge As String = "lc=1033,id=507,tw=40,fs=1,ru=http%3A%2F%2Fmessenger%2Emsn%2Ecom,ct=110 2256618,kpp=1,kv=5,ver=2.1.6000.1,tpf=f5e725aac530ece70e1e129c95b2e670" ' Dim ServerRequest As System.Net.WebRequest ServerRequest = System.Net.HttpWebRequest.Create("https://loginnet.passport.com/login2.srf") ServerRequest.Headers.Set("Authorization", "Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=" _ & Replace("zach@tong-web.com", "@", "%40") & ", pwd=" & "******" & "," & strchallenge) ' Dim ServerResponse As System.Net.WebResponse = ServerRequest.GetResponse() ServerResponse.Close() ' Debug.WriteLine(ServerResponse.Headers.ToString)
which gives me:

Quote:
Connection: close
Date: Sun, 05 Dec 2004 15:17:56 GMT
Server: Microsoft-IIS/6.0
PPServer: PPV: 25 H: BAYPPLOG2A01 V: 1113
Content-Type: text/html
Expires: Sun, 05 Dec 2004 19:17:56 GMT
Cache-Control: private
P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
Set-Cookie: BrowserTest=Success?; domain=.passport.com;path=/;HTTPOnly= ;version=1,MSPRequ=lt=1102259876&co=1&id=3,vv=25; HTTPOnly= ; domain=.passport.com;path=/,MSPPost=0; domain=.passport.com;path=/;version=1
Content-Length: 1531
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #5  
Old 12-06-2004, 11:22 AM
peanutman's Avatar
peanutman peanutman is offline
Junior Contributor
 
Join Date: Sep 2003
Location: Belgium
Posts: 316
Default

a very odd problem indeed...

it works perfectly when you hardcode (add the content of strChallenge into the code yourself) strChallenge.
but if you use "& strChallende" it just gives this "value" error...
there is definatly something wrong with the string... something that seems to go away after you copy/paste the string.... very odd indeed

thx for your help.. it helped me a lot, at least now i know whats the problem
i'll go try find out whats wrong with the string, do some tests with it and stuff.

EDIT:
WHOOHOOO, i found it!!!! i did some testing, and found out strChallenge was always 3 chars longer then the same string if i displayed it in a textbox.
so now i use: strChallenge.Substring(0, strChallenge.Length - 3) instead of just strChallenge, and it works like a charm... so these 3 last chars must be some invissible controlchars or something, anyhow, it works fine now
THANK YOU
__________________
http://free-b.org

Last edited by peanutman; 12-06-2004 at 11:55 AM.
Reply With Quote
  #6  
Old 12-06-2004, 01:49 PM
excaliber's Avatar
excaliberError on httpserver excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Glad its working. As a side note, I usually get rid of control chars unless they are needed:

Code:
strchallenge.Replace(vbLf,"").Replace(vbCr,"").Replace(chr(0),"") 'etc etc
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Error on httpserver
Error on httpserver
Error on httpserver Error on httpserver
Error on httpserver
Error on httpserver
Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver Error on httpserver
Error on httpserver
Error on httpserver
 
Error on httpserver
Error on httpserver
 
-->