473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Lose session variables in a projet but not in other one...

Hi,

Well, my problem is so simple as it says in the subjet but very frustrating
also. I have a project and it is losing the session variables with each
postback, so I downloaded from the web a project which used a session
management dll to discover what was wrong in my project. This web project has
two pages, one send to the other a variable with session state and the other
changes this one, shown in a label, with each postback, well, quite simple.
Ok,it runs right and the use I do with my project is similar. In fact I added
the dll of this project into my project and the two pages, to start the
project with them but it didn't kept the value of the session variables.

So... (I hope you understand me, I don't know if I explained fine) what
problem do you think I have? Maybe it's a problem related with the IIS? Any
kind of configuration for the project in Visual Studio? I've spent too much
time trying to resolve this problem but I just can't know in any way what's
the matter.

Thanks a lot in advance.
Jan 18 '06 #1
2 1994
Session variables can be lost due to the following reasons:

1. Session timeout has reached.
2. The AppDomain that was running your ASP.Net app has been torn down
and a new AppDomain was created (Happens when the probject is rebuilt,
or the dlls in the bin / App_Bin (2.0) directory have been replaced)
3. IIS is restarted.

Assuming its not 2/3 the most likely problem is that the session
timeout is the reason. Try tweaking the session timeout of your project
in the web.config file:

<configuration>
<system.web>
<sessionState timeout="5"/> <!-- Sets the timeout to five minutes
-->
</system.web>
</configuration>

And then retry your app. If the session variables are still being lost,
Id trace your application and see if any code is being executed while
transferring execution to the second page that resets / removes the
session variables.

If both of them do not solve the problem, the timeout problem might be
in IIS. Open IIS Manager, navigate to your virtual directory, right
click and select properties. In the Virtual Directory tab, click the
configuration button. Select App Options, there should be Session
Timeout option under Enable Session State. Set this value to 5 (in
minutes). To be sure restart IIS, and check your app again.

If all these do not work, then it has nothing to do with IIS or session
timeout and most likely the session variables are either being affected
by code, or the AppDomain is being reset for some reason.

Hope this helps...

- NuTcAsE

Jan 18 '06 #2
Hi NuTcAsE,

First, thanks for your effort replying to my problem. In the IIS is not the
problem as the session state is enabled and the timeout is up to 20 minutes.
Maybe the problem is in the web.config, but I'm not too sure... Let's see,
the first page is in the application folder where it's placed the web.config
too. This web.config has the sessionState up to 20 minutes. But -and here is
where I think there could be a problem- the default.aspx, the login,
transfers to a second page located in a subfolder. This second page receives
the session variable right, but on postback is lost. And in this folder
there's another web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>

That's all. I tryied to write here the tag <sessionState timeout="5"/>, but
I can't do it, asp.net throws an error when arriving here ("t's incorrect to
use a registered section as allowDefinition='MachineToApplication' more over
the application level").

So as I'm quite newbie, I don't know what's wrong here. In any case thanks
again for your answer, I'll keep on trying. If I discover something I'll post
it, of course! :)

Greets,
Tomás.

"NuTcAsE" wrote:
Session variables can be lost due to the following reasons:

1. Session timeout has reached.
2. The AppDomain that was running your ASP.Net app has been torn down
and a new AppDomain was created (Happens when the probject is rebuilt,
or the dlls in the bin / App_Bin (2.0) directory have been replaced)
3. IIS is restarted.

Assuming its not 2/3 the most likely problem is that the session
timeout is the reason. Try tweaking the session timeout of your project
in the web.config file:

<configuration>
<system.web>
<sessionState timeout="5"/> <!-- Sets the timeout to five minutes
-->
</system.web>
</configuration>

And then retry your app. If the session variables are still being lost,
Id trace your application and see if any code is being executed while
transferring execution to the second page that resets / removes the
session variables.

If both of them do not solve the problem, the timeout problem might be
in IIS. Open IIS Manager, navigate to your virtual directory, right
click and select properties. In the Virtual Directory tab, click the
configuration button. Select App Options, there should be Session
Timeout option under Enable Session State. Set this value to 5 (in
minutes). To be sure restart IIS, and check your app again.

If all these do not work, then it has nothing to do with IIS or session
timeout and most likely the session variables are either being affected
by code, or the AppDomain is being reset for some reason.

Hope this helps...

- NuTcAsE

Jan 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brad | last post by:
Hi everyone, I've been using ASP on a few different projects over the past year, either using Javascript or VBScript. During that time, I've made use of session variables, but even then, I've...
9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
5
by: Larry Woods | last post by:
I am losing Session variables, but only those that are set in the page previous to a redirect to a secure page. Anyone seen ANY situation where Session variables just "disappear?" Note that...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
10
by: Michael SL | last post by:
I have been using session variables in my asp.net application without any trouble. But now in a very specific case I am losing them. On one of my pages I set a date in a dropdownlist...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
6
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.