Link to home
Start Free TrialLog in
Avatar of rossmcm
rossmcmFlag for New Zealand

asked on

Request.Form undefined on localhost but OK when ASP filed upl,oaded to web

I have an ASP page that implements a login function and has a form with a Login Name field and password field.  When the user clicks on the button it submits the form to another ASP page.  That page looks up the details in a database and logs the user in if OK.  All pretty standard stuff, and it works fine.  

However I thought I would speed things up b y developing it on the local machine instead of the edit/FTP/Test cycle.  So I installed IIS and it goes except that the contents of the Forms collection are all undefined.

when the files are on the web:

  Request.Forms ("LoginName")

returns a string containing whatever the user had typed in the field.

when the files are on the local machine:

  Request.Forms ("LoginName")

returns undefined.

what could be different?

heres the form:

<form name="LoginForm" action="membervalidate.asp?backto=<%=Server.URLEncode (Request.querystring ("backto")) %>" method="post">
  <input type="text" name="LoginName" size="16" maxlength="50">
  <input type="password" name="Password" size="16" maxlength="50">
</form>


and here is membervalidate.asp:

....
var Connection = OpenDatabase () ;
if (Connection != null)
    {
    Response.write (Request.Form ("LoginName") + "<br>") ;                            // writes "Undefined"
    Response.write (Request.Form ("LoginName").Item + "<br>") ;                    // writes "undefined"
....
ASKER CERTIFIED SOLUTION
Avatar of kevp75
kevp75
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Carl Tawn
Is it just Request.Form that isn't playing, or is it the ASP objects in gereral ?
also....is this running on IIS?
Avatar of rossmcm

ASKER

Yes, IIS, Windows XP SP2.  Everything else about the site seems to go OK - database access (once I changed the path) is OK, querystring works OK.
try using request("formfiled") instead of request.from("formfield")

see if that works.

i think I just saw what the problem may be.....in the code you posted you have a space after Request.Form.....if it is not a typo, get rid of that space on both, and try it out
in other words you have:
Request.Form ("LoginName")

change it to:
Request.Form("LoginName")
Avatar of rossmcm

ASKER

aaaarrrrgggghhhh!!!   It now works.  The only thing I did was went to bed.  So it might be that installing IIS and then not rebooting before I tried to use it was not a good idea.

Sorry to waste your time.  You get the points anyway.

Incidentally, I don't see how the inserted space would make any difference - white space is white space isn't it?  I could presumably have

  Request.Form
    ("LoginrName")

or  

  Request.Form                      ("LoginrName")

essentially you can have all the whitespace in the world, but..... I have run into problems using some funstions and having to many spaces.

LOL.....it's amazing what sleep'll do to a body  :)

thanks for the points