Click to See Complete Forum and Search --> : passing parameters from one frame to another
nmretd
Oct 10th, 2000, 05:26 AM
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 ?
Berthil
Oct 10th, 2000, 06:51 AM
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.
monte96
Oct 10th, 2000, 10:25 AM
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
<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>
Berthil
Oct 10th, 2000, 05:36 PM
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.
monte96
Oct 10th, 2000, 07:40 PM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.