I use Session["UserName"] to save and pass values between pages, (please see
the following). It works fine on my computer, but on the server, I launch the
main page, wait for 20 minutes, and click a button to launch User.aspx, it
seems that it cannot see the current value of Session["UserName"]. There's no
problem to launch User.aspx from the main page within 20 minutes. Please
help. Thanks.
//Users.aspx
if (!Page.IsPostBack)
{
if (Convert.ToString(Session["UserName"]) != "")
{
//Do something
}
}
> I use Session["UserName"] to save and pass values between pages, (please
> see
> the following). It works fine on my computer, but on the server, I launch
> the
> main page, wait for 20 minutes, and click a button to launch User.aspx, it
> seems that it cannot see the current value of Session["UserName"]. There's
> no
> problem to launch User.aspx from the main page within 20 minutes.
20 minutes is the default time that a session exists before it is torn down
to conserve server resources.
Either increase the session timeout value,
http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=Session%2eTimeout
or change your logic...
http://www.google.com/search?q=Session.IsNewSession&rls=com.microsoft:*:IE-Address&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7GGIH
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
This also helps prevent errors from being thrown if you attempt to convert
upon a null object.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
"John" <Jo...@discussions.microsoft.com> wrote in message
news:C609B973-6B56-4417...@microsoft.com...
"John" <Jo...@discussions.microsoft.com> wrote in message
news:C609B973-6B56-4417...@microsoft.com...