|
-
Sep 8th, 2000, 02:25 PM
#1
In my login page, when the password is wrong,
there is
response.redirect "login.asp"
But the loginname too is blanked out and the page is displayed again.
I have a session variable for the login name but i am not sure how to pass this on so that only the password is blanked out on redirecting.
Any help would be appreciated.
Thanks.
-
Sep 8th, 2000, 10:54 PM
#2
Frenzied Member
I'm assuming you are passing the values from the Form on submit back to your login page for processing AND using method=post. (You could also have it the submit action access another page, but keeping all your login code on one page is probably the best way to do it).
You will need to do something like this for your <INPUT> tag:
Code:
<%If Len(Request.Form("txtName")) > 0 Then%>
<INPUT type=Text name=txtName value=<%=Request.Form("txtName")%>>
<%Else%>
<INPUT type=Text name=txtName>
<%End If%>
When the form data is submitted back to the page, it will display the name that was there before.
If you are using a second page to handle the password checking, you can use a querystring to pass the name to the login page:
Code:
<%
Response.Redirect "Login.asp?" & Request.Form("txtName")
%>
'Then on your login page do this:
<%If Len(Request.Querystring("txtName")) > 0 Then%>
<INPUT type=Text name=txtName value=<%=Request.Querystring("txtName")%>>
<%Else%>
<INPUT type=Text name=txtName>
<%End If%>
Hope this helps
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Sep 9th, 2000, 11:38 AM
#3
Hyperactive Member
well, as far as I can see it, you can use:
if you are using the form ..
<INPUT type=Text name=txtName value=<%=Request("txtName")%>>
if there is no "txtName" anywhere, it will just stay blank (no need for those if statements).
if you have the session variable set up correctly then you can do:
<INPUT type=Text name=txtName value=<%=session ("USERNAME")%>>
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Sep 13th, 2000, 11:29 PM
#4
Hyperactive Member
I'm not sure how many people you are expecting to use this page but you should make sure you are clearing the sessions after each one is no longer needed. If not your server will leak memory very fast.
If you think education is expensive, try ignorance.
-
Sep 14th, 2000, 12:46 AM
#5
Frenzied Member
There is actually no need to use the session object if the login failed. Only populate the name into the session object if the login was successful. But, that is a valid point. a Session.Abandon at the top wouldn't hurt.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|