|
-
Oct 10th, 2000, 05:26 AM
#1
Thread Starter
Addicted Member
I am using 2 frames. The left frame deals with site navigation and user login. Currently, when my user logs in I validate the login and then find the first name and lastname of the user and hold the values in strFirstName and strLastName.
Once I have this information I then display a message to the user, which is: Welcome Firstname Lastname.
However, I want to display this welcome message in the right frame. Is this possible. If so, how do I code it please ?
-
Oct 10th, 2000, 06:51 AM
#2
Member
Pass by Session Object
I'm a newby with ASP but I created a large database application and I store the login name in the session object
store:
Session.Contents("user") = "me"
read when loading page:
varUser = Session.Contents("user")
The Session is destroyed when the user closes the Browser
But maybe I think to simple because I'm a newby.
A mind is like a parachute, it has to open to let it work
www.2beesoft.com for Icon Manager with over 20.000 free icons
VB6 Ent. SP4, ASP, W2000/W98
-
Oct 10th, 2000, 10:25 AM
#3
Frenzied Member
Actually, the session is not destroyed when the user closes the browser. It is maintained on the server for as long as the session.timeout value is set for or however long it has been set up to live through the IIS console.
Even worse, if the user closes the browser and goes back to the same site, a NEW session is created but the old one still lives. This is because session IDs are maintained on the client side with a cookie in memory. When the browser gets closed, that ID is gone from the client side but the server side has no way of knowing when the browser is closed so it stays open. (Default is 20 mins)
You could do it with a session object, but you could also do it with a querystring to the other page and reference the frame by name. Pass the values like:
strURL = "MyOtherPage.asp?fname=" & strFirstName & "&lname=" & strLastName
Code:
<HTML>
<HEAD>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function button1_onclick() {
//This assumes that frame2 is named 'frame2'
parent.frames.frame2.location.href='MyOtherPage.asp?fname=<%=strFirstName%>&lname=<%=strLastName%>'
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT name=button1 type=button value=Login name=button1 LANGUAGE=javascript onclick="return button1_onclick()">
</BODY>
</HTML>
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..
-
Oct 10th, 2000, 05:36 PM
#4
Member
I didn't know that the session is kept for 20min. Anyone has some code to destroy the Object. I have a logout option so I can put any code there. I know make the user string empty when logging. Is that enough?
Passing with Querystring works of course, but can be visible to all in the URL in the address bar of the Browser. Sometimes that's not desirable, since usernames usually also require a password or login status, and you cant pass that by querystrings.
I create a status after a succesfull login and let pages build (or not) depending on the status in the Session Object. Like status administrator can view al pages, but status Guest may view some. I check the status at page load and redirect to the login page if not sufficient rights through the status.
A mind is like a parachute, it has to open to let it work
www.2beesoft.com for Icon Manager with over 20.000 free icons
VB6 Ent. SP4, ASP, W2000/W98
-
Oct 10th, 2000, 07:40 PM
#5
Frenzied Member
session.abandon will kill the session before the timeout. You can put it on a logout page.
But if a user chooses to simply leave the site or close the browser without logging out, it will live until the timeout expires.
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
|