HtmlView and Login

BlitzPlus Forums/BlitzPlus Programming/HtmlView and Login

Orca(Posted 2005) [#1]
I'm probably just being thick here, but how would I go about logging into a site thru the htmlview gadget(in code)? There's a form on a webpage, and I need to give it username/pass...

Any help or pointers is mucho appreciated :)


NetGamer(Posted 2005) [#2]
If it's a vanilla form tag embedded within the web page (rather than a popup dialog), you can code the login via a parameterized url.

Say the form tag used 'name' and 'pass' for the name and password fields and had http://myweb.com/process.exe as the action associated with the form:
URL would be:
http://myweb.com/process.exe?name=Mike&pass=secret


I might not have the terminoligy perfect, but the url syntax is simply the target plus a question mark then a series of keyword value pairs seperated by ampersands. Use %20 for embedded spaces or try using single quotes.


Orca(Posted 2005) [#3]
Thanks alot, I'll give that a shot :)


Orca(Posted 2005) [#4]
I'm getting this error from the server:

Microsoft VBScript runtime error '800a01f4' 

Variable is undefined: 'temp_var1' 

/checklogin.asp, line 173


I've tried different variations of the url string to no avail. Just to be sure, should I also be including hidden form elements? There's one called back_url which seems to be blank when inspecting the page in firefox...how would I add that to the string?

Also, could javascript be interfering with this?
<form method="POST" name="loginfrm" onSubmit="return document.MM_returnValue" action="/checklogin.asp" ID="Form2">


Dunno, the whole webpage is a ratsnest, and I feel like I'm just shooting in the dark now :/


Craig Watson(Posted 2005) [#5]
You can't put values in the querystring for a post operation.

From memory in ASP, POST values are returned in a Request.Form method, whereas GET values are returned in a Request.Querystring method. The server is expecting a post.

If you control the backend you could change the ASP code to check for a querystring, I'm not aware of any way to use the HTML View to post data.

You could post the data through a TCP connection, but then you're probably going to have to mess about with cookies and the like.

I'm not really sure what you're trying to achieve here. If you control the systems involved, surely you'd be better off bypassing the web stuff and just talking pure TCP.


Orca(Posted 2005) [#6]
Thanks for the info.

No, I don't have any control over the site. This is actually for someone who wanted a custom browser type of thing.

I thought this would be a simple job with b+ but erm...that doesnt seem to be the case now.


FlameDuck(Posted 2005) [#7]
Is there any particular reason why simply using the HTMLView doesn't work?

[quote]I thought this would be a simple job with b+ but erm...that doesnt seem to be the case now.[quote]It depends on what exactly you're trying to achieve. Using http 1.1 authorization you can pass paramaters like so:[code]http://username:password@... Apache this can be controlled by the .htaccess file, or alternatively be made accessible to an underlying script engine (like PHP). I'm sure a similar functionality exists with ISS and ASP webservices. You would probably want to send this information using an SSL encrypted connection tho' - sending plaintext passwords is a bit dangerous.

Whether this is a simple job or not in B+ (or any other language for that matter) is mostly a case of how well written / designed the site in question is.


Craig Watson(Posted 2005) [#8]
You might need to do some fact checking, since I'm more of a Linux/Apache person these days, but here goes:

IIS can log you in the way Apache would with a .htaccess, but this AFAIK requires an actual user account for every single login you want to use. Granted you could create a whole bunch of crippled accounts for a website to use, but this seems way harder and less secure to me than editing a few text files or even entering some stuff into MySQL.

Most ASP authentication is done using forms with a table of users in SQL Server. There may be better ways, not that I've ever seen them - perhaps some MS person can fill me in.

It's all somewhat moot because Orca doesn't control the website.