post to asp site

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tbalazs
Posts: 9
Joined: Tue Sep 22, 2009 10:21 pm

post to asp site

Post by tbalazs » Tue Sep 22, 2009 10:25 pm

Newbie question here. How would I pass username and password to a login form that is located on a remote web server running asp? Entering http://www.thesite.com/login.asp?userna ... d=password as the URL doesn't work.
Thanks.
Tony.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Sep 23, 2009 9:41 am

That would be using the GET method of submitting, which would not be the method wanted by the server (for password authentication it would be inherently insecure). You need to POST the data to the form.

If go to the web page in your browser and look at the source code, you need to find the names of the items being submitted, so that you can make name=value pairs to POST. If you then get RunRev to make those name and value pairs (using libUrlFormData for example) and put them into theSubmissionData then

Code: Select all

post theSubmissionData to URL ("http://thesite.com/login.asp")
you should get the server to validate the submission.

Quite what happens after that is another matter. The validation of your login submission will, no doubt, get the server to generate session cookies which under normal circumstances your browser will handle automatically and keep your authenticated session alive for the duration of your connection.

If you use the LiveHTTP headers in Firefox, you will be able to see the real time header exchanges that take place when you log into a site and browse around it. You will see such things as "Set-cookie: xxxxxx" coming from the server, and on your next navigation in that site, your browser will show "Cookie: xxxxxx" in the headers it submits. That can help you understand how the data exchanges work and what you need to look for and pass to the server to log in and navigate around.

In RunRev, you will need to use the libURLLastRHHeaders function to view the response from your login post. In the data returned, you will need to parse out the "Set-cookie:" information and get the values that were set for this session. Then you will need to use

Code: Select all

set the httpHeaders to "Cookie: name=value[;name=value]"
or such, that you extracted from the libURLLastRHHeaders result. If RunRev submits that cookie with every request for a page (which it should do, until you reset the httpHeaders) then the server should accept the request as coming from a valid session.

There is some more discussion about this in this thread: http://forums.runrev.com/phpBB2/viewtopic.php?t=2066

HTH
SparkOut

tbalazs
Posts: 9
Joined: Tue Sep 22, 2009 10:21 pm

Post by tbalazs » Mon Sep 28, 2009 2:20 am

Apologies for the delay in replying and thanking you. I really appreciate it.
Yes, this helps a lot.
Tony.

tbalazs
Posts: 9
Joined: Tue Sep 22, 2009 10:21 pm

Post by tbalazs » Wed Sep 30, 2009 4:38 pm

In the top field of the message box I get: start using "libSQLYoga" and in the lower field I get the URL I am posting to.

Does this seem right?
Thanks.
Tony.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Sep 30, 2009 8:00 pm

Well... who knows?
It seems to me that it's just showing the last thing you typed in the input line, and the url being put in the message box window suggests that you have a line in your script somewhere that "puts" some data, which presumably is meant to hold the destination.
We'd need to see some more code to be able to know what's going on.

Post Reply