Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2004, 06:26 PM
Authorized User
 
Join Date: Jan 2004
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?
 
Old January 15th, 2004, 06:30 PM
Authorized User
 
Join Date: Dec 2003
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

 
Old January 16th, 2004, 10:02 AM
Authorized User
 
Join Date: Jan 2004
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?
 
Old January 16th, 2004, 10:10 AM
Authorized User
 
Join Date: Jan 2004
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.





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





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