I hope some of you can help me with a dilemma I am facing.
BACKGROUND
----
I have a published application that has a web page login where users
(that subscribe to a third party service) can automatically log into
the third party's web page and retrieve a simple data file once
logged in (a simple text file). Previously, the web server used a
standard HTML form for the member log in. Recently, the third party
changed to an ASP.NET server, and I am having trouble getting the
login to work again. (argh!)
My difficulty is in getting my RealBasic app to correctly carry out
the handshake to get the login cookie. Below I have under GET
snippets of my code, followed by the server's RESPONSE. The login
page uses a post via Javascript to:
form name="aspnetForm" method="post" action="Default.aspx?ReturnUrl=%
2fmembers%2f&host= aspserver.com" onsubmit="javascript:return
WebForm_OnSubmit();" id="aspnetForm">
You will see that the post-login attempt results in a generic error
page. I have been using an HTTP sniffer program to try to replicate
everything that the browser sees or sends to no avail.
Any ideas on how I can get this working?
Thanks,
Brad
GET
--------------
HTTPSocket1.SetRequestHeader("Accept","image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, application/x-shockwave-flash, */*")
HTTPSocket1.SetRequestHeader("Accept-Language", "en-us")
HTTPSocket1.SetRequestHeader("Accept-Encoding", "gzip,deflate")
HTTPSocket1.SetRequestHeader("User-Agent","Mozilla/5.0 (Macintosh;
U: Intel Mac OS X; en-us) AppleWebKit/418.91 (KHTML, like Gecko)
Safari/419.3")
HTTPSocket1.SetRequestHeader("Host","aspserver.com")
HTTPsocket1.Get "aspserver.com/dir1/Default.aspx?ReturnUrl=/
members/&host=aspserver.com"
RESPONSE
----------------
HTTP Status: 200Connection : close
Date : Sat, 10 Feb 2007 21:31:13 GMT
Server : Microsoft-IIS/6.0
X-Powered-By : ASP.NET
X-AspNet-Version : 2.0.50727
Set-
Cookie : .ASPXANONYMOUS=wbJ3oOyDxwEkAAAAYmZjNzdmNGMtYzRlYy00Mjk0LTk4MWUt
NDZmNDA3NjNjMTNmP0uBboJhYfVztXz3BJs2eSMuHhs1; expires=Sat, 21-
Apr-2007 08:11:13 GMT; path=/; HttpOnly
Set-Cookie : ASP.NET_SessionId=bbwidlebwecpc3ikh0kdfz45; path=/;
HttpOnly
Cache-Control : private
Content-Type : text/html; charset=utf-8
Content-Length : 9637
GET
------------------
Headers Received Event
-----
for i = 0 to (headers.Count-1)
if InStr (headers.value(i), "ASPXANONYMOUS") > 0 then
ASPANON = NthField(headers.Value(i), ";", 1)
end if
if InStr (headers.value(i), "SessionId") > 0 then
auth1 = NthField(headers.Value(i), ";", 1)
end if
next
aspcookie = ASPANON + "; " + auth1
Page Received Event
------
I parse out the values for Viewstate and Eventvalidation in my code....
fields = New Dictionary
fields.Value("__EVENTTARGET") = ""
fields.Value("__EVENTARGUMENT") = ""
fields.Value("__VIEWSTATE")= viewstate
fields.Value("ctl00%24ContentPlaceHolder1%24UserName")="myusername"
fields.Value("ctl00%24ContentPlaceHolder1%24Password")="mypassword"
fields.Value("ctl00%24ContentPlaceHolder1%24LoginButton.x")="29"
fields.Value("ctl00%24ContentPlaceHolder1%24LoginButton.y")="9"
fields.Value("__EVENTVALIDATION") = eventvalidation
HTTPlogin.SetRequestHeader("aspcookie", aspcookie)
HTTPlogin.SetRequestHeader("Accept","image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, application/x-shockwave-flash, */*")
HTTPlogin.SetRequestHeader("Accept-Language", "en-us")
HTTPlogin.SetRequestHeader("Accept-Encoding", "gzip,deflate")
HTTPlogin.SetRequestHeader("User-Agent","Mozilla/5.0 (Macintosh;
U: Intel Mac OS X; en-us) AppleWebKit/418.91 (KHTML, like Gecko)
Safari/419.3")
HTTPlogin.SetRequestHeader("Connection", "keep-alive")
HTTPlogin.SetRequestHeader("Host", "www.aspserver.com")
HTTPlogin.SetFormData fields
HTTPlogin.Post "http://aspserver.com/dir1/Default.aspx?ReturnUrl=%
2fmembers%2f&host=aspserver.com"
RESPONSE
-------------------
Connection : keep-alive
Date : Sat, 10 Feb 2007 21:31:13 GMT
Server : Microsoft-IIS/6.0
X-Powered-By : ASP.NET
X-AspNet-Version : 2.0.50727
Location : /dir1/Errors/GenericError.aspx?aspxerrorpath=/dir1/
Default.aspx
Cache-Control : private
Content-Type : text/html; charset=utf-8
Content-Length : 188
Object Moved HTML in page body with a link to something like:
Object moved to href="/dir1/Errors/GenericError.aspx?aspxerrorpath=/
dir1
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>