473,320 Members | 1,856 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,320 software developers and data experts.

Using Session variable in ASP.NET page

When a user logs into my site, I create a cookie with their UserID, but
I wish to also create a Session variable to track their "UserType".

I do this as follows:

Session("UserType") = "admin"

(or whatever value I give the usertype)

I use this session variable to output a user-specific menu.

This works fine, until I pause using the page for about 5 minutes, then
when I go back to the page, the session variable has disappeared
(expired).

Is this expiry timeout something I need to set on the server, or is
there a better approach I should take to this problem using ASP.NET?

Thanks.
--

fiddlewidawiddum
Feb 13 '06 #1
4 1200
Hi,

If you are looking for session expiry event, you have to do this on the
server. This event would be available in Global.aspx.cs file.

Cheers,
Kris

Feb 13 '06 #2
On Mon, 13 Feb 2006 Kris <kr***********@gmail.com> wrote:
Hi,

If you are looking for session expiry event, you have to do this on the
server. This event would be available in Global.aspx.cs file.

Cheers,
Kris


actually I think I've found it... I can change the timeout flag in the
sessionState tag in web.config
--

fiddlewidawiddum
Feb 13 '06 #3
Yes. Session expiry timeout has to be set in Web.Config file.

Thanks,
Cheers,

Feb 13 '06 #4
Or in machine.config, if you're using ASP.NET 1.1.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Kris" <kr***********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Yes. Session expiry timeout has to be set in Web.Config file.

Thanks,
Cheers,

Feb 13 '06 #5

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

Similar topics

2
by: Bonj | last post by:
H I've got the following problem - I need to have an aspx page with two frames, although the question isn't necessarily about the workings of the frames, more session variables... the frames consist...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
2
by: Todd | last post by:
Here's one that has been stumping people: I'm writing in ASPX with VB.NET On the login page I set the entered usename text to a session variable....
7
by: Spencer H. Prue | last post by:
Hello!, I have a using system.web.sessionstate directive one the top of each of two web pages. On the first page I have the dataadapter, dataconnection, and dataset (also in the component tray)....
4
by: T Ralya | last post by:
I am told that ASP.NET controls the session ID and session variables, but that does not fit my symptoms. I am posting here as directed. I'm hoping that someone can at least recommend something to...
15
by: Joe Fallon | last post by:
I would like to know how you can figure out how much memory a given instance of a class is using. For example, if I load a collection class with 10 items it might use 1KB, and if I load it with...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
5
by: Reds | last post by:
HI, I have just started using Web Forms. It seems that I'm not able to do some things that Windows Forms allow me to do. For example, I tried to implement a counter using a module level...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.