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