Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 15th, 2004, 06:26 PM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Losing session variables

I have several links on a website that go to different crystal reports. When I log in, click on a link to a report and use the back button go back to the main page the first time, I don't have any trouble. But the second time I lose my username session variable. Is this a common problem? It seems like if it works the first time it would work subsequent times as well but obviously I am doing something wrong.

This is the code I'm using to check for the session variable on my main page.
<%if Session("user") = "username" then%>

Like I said it works on login and on the first back button action but then it won't work. Any thoughts?
Reply With Quote
  #2 (permalink)  
Old January 15th, 2004, 06:30 PM
Authorized User
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Two things.

First, check the session.expires property. It should be 20 minutes but perhaps it is set for a shorter period.

Secondly, and more likely, switch your logic...<%If Session("user")<>""%> Perhaps it is 'losing' the value of "username" and returning a boolean false thereby not executing the remaining code.

Let me know if this helps
John

Reply With Quote
  #3 (permalink)  
Old January 16th, 2004, 10:02 AM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great suggestion. I hadn't thought of it. But unfortunately it didn't work. The expires property is set at 90 which should be more than enough. The part that gets me is it works the first time, but then quits working. Any other ideas?
Reply With Quote
  #4 (permalink)  
Old January 16th, 2004, 10:10 AM
Authorized User
 
Join Date: Jan 2004
Location: Frederick, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Someone suggested I open the reports in a new window to avoid losing my session variable. A little messy but it works. Still open to suggestions but I've solved the immediate problem. Thank you for your help.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing a session variable Abbas Classic ASP Professional 2 March 21st, 2007 04:00 PM
Variables losing their values jrensink78 ASP.NET 1.0 and 1.1 Basics 3 April 13th, 2006 01:09 PM
Constantly losing PHP session variable? achalasia PHP How-To 3 October 29th, 2004 09:08 AM
Losing variables bluemat XSLT 2 October 16th, 2004 01:59 AM
Losing form variables (from posting) BunaZiua Dreamweaver (all versions) 1 February 23rd, 2004 04:46 PM



All times are GMT -4. The time now is 07:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.