473,472 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

asp.net cookie timeout

I want my asp.net application to create a non persisitent cookie that
will timeout after 20 minutes.

I want the cookie to expire when the bowser is closed AND timeout if
the user has been inactive (sliding expiration)

How can I accomplish this?
If i set the expiration time on the cookie, it ceases to be non
persistent, and the user stays logged in if the browser was closed and
re-opened in under 20 minutes.

Thanks.

Jan 12 '06 #1
4 1412
Sridhar,

I just answered the same questions for Belle below...

MyCookie.Expires = Now.Add.Minutes(20)

And then make certain to use the forms authentication object's redirect:

FormsAuthentication.RedirectFromLoginPage(username .Text, false)

Setting the second parameter lets you specify if a cookie is persistent.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<kr**************@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
I want my asp.net application to create a non persisitent cookie that
will timeout after 20 minutes.

I want the cookie to expire when the bowser is closed AND timeout if
the user has been inactive (sliding expiration)

How can I accomplish this?
If i set the expiration time on the cookie, it ceases to be non
persistent, and the user stays logged in if the browser was closed and
re-opened in under 20 minutes.

Thanks.

Jan 12 '06 #2
I'm not totally sure on this, but I believe you are asking too much of the
HTTP cookie specification.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"kr**************@gmail.com" wrote:
I want my asp.net application to create a non persisitent cookie that
will timeout after 20 minutes.

I want the cookie to expire when the bowser is closed AND timeout if
the user has been inactive (sliding expiration)

How can I accomplish this?
If i set the expiration time on the cookie, it ceases to be non
persistent, and the user stays logged in if the browser was closed and
re-opened in under 20 minutes.

Thanks.

Jan 12 '06 #3
and that fixes it!

thanks, Justin.

Jan 12 '06 #4
YW :-)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<kr**************@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
and that fixes it!

thanks, Justin.

Jan 12 '06 #5

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

Similar topics

7
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but...
0
by: Sebastien Roeckel | last post by:
Hello I have a problem with the authentication cookie timeout in a forms authentication. I've developed a Web application that uses forms authentication. My web.config is configured for the...
0
by: Kepler | last post by:
I'm testing very basic FormsAuthentication and having trouble with non-persistent cookies. Once authenticated with a non-persistent cookie, if I leave the browser alone for 30 minutes,...
0
by: briand | last post by:
I have the following code in my base page to redirect to a session timeout page. override protected void OnInit(EventArgs e) { base.OnInit(e); //It appears from testing that the Request...
2
by: Martin Dew | last post by:
Hi, I am using ASP.Net for a website, I use the following code; <authentication mode="Forms"> <forms name=".ADASTRATEAROUNDS" loginUrl="login.aspx" protection="All" timeout="30" path="/"> ...
8
by: bashful.belle | last post by:
I'm using Forms authentication and a non persistent cookie in my asp.net application. How do i get the cookie to time out after a period of inactivity, say 10 minutes, and force the user to login...
15
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok....
7
by: Adam Bates | last post by:
Hello, I have a problem, I have been using Cookie Authentication on the 1.1 framework for around 3 months, when I moved the site internally within my hosting company from a server with 1.1...
5
by: SJ | last post by:
Hi, In my website, i have a cookie that allows the user to remain logged in for upto 90days. So I'm setting the cookie expiration time to 90 days in the future from the time the user logs in....
4
by: GaryDean | last post by:
I'm using the 2.0 login control with the "remember me" setting. When checked the cookie only last for a few hours then it is asking again for a login. I don't see any time settings. I know back...
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
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,...
1
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.