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

Home Posts Topics Members FAQ

Persistent Cookies

Hello everyone,

I didn't get any response in "Security" forum hence posting here again.

I am having problem with persistent cookies. Even after setting
"CreatePersistentCookie" to true in "FormsAuthentication.SetAuthCookie" I'm
being logged out after the specifed timeout provided in "forms"
element of web.config.

I read somewhere that lifetime of persistent cookies depend on the timeout
attribute on the forms authentcation node. If I have to enter a timeout of
days/weeks then it doesnt really make sense to make my cookie persist in
this fashion, that defies the purpose of persistent cookies.

Any insights welcome
Thanks
Sanchita
Mar 26 '07 #1
3 4280
You miss the purpose of persistant cookies. They are not used for session
management, they are used for authentication.

A persistent cookie is designed to allow the user to access a secured site
without having to log in again when he hits the site the second time. It
persists the authentication on the client side so it is sent with the
header. The system then automatically logs him in.

Session timeout is a part of your application. While the cookie can "re-log
on" the user if he times out, it cannot change the timeout behavior on the
server just because the user has a cookie.

For the record, you should NOT increase timeout to days. That defeats the
purpose of session management. What you can do is kick the user back to the
start page and abandon session, forcing the timeout. You then provide a link
on the timeout page. This can be a dynamic link back to where he was
working, if you desire. The user will then be logged back in, as the cookie
is there.

This may not be what you envision and make you think you want to increase
session time until the year 2010. Here is why. The session timeout is how
long the server keeps objects in session, meaning in memory on the server.
You set a really long timeout, say two weeks out. That session is now open
for two weeks. User's computer crashes and he opens the browser and hits
your site. You now have 2 two-week sessions for one user. After some work,
the user shuts down and then opens the browser again and hits the site. You
now have 3 two-week sessions for one user. This can go on until you use all
of the memory on the server with just a couple of users.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"sanchita" <sa******@fareportal.comwrote in message
news:OS****************@TK2MSFTNGP04.phx.gbl...
Hello everyone,

I didn't get any response in "Security" forum hence posting here again.

I am having problem with persistent cookies. Even after setting
"CreatePersistentCookie" to true in "FormsAuthentication.SetAuthCookie"
I'm
being logged out after the specifed timeout provided in "forms"
element of web.config.

I read somewhere that lifetime of persistent cookies depend on the timeout
attribute on the forms authentcation node. If I have to enter a timeout of
days/weeks then it doesnt really make sense to make my cookie persist in
this fashion, that defies the purpose of persistent cookies.

Any insights welcome
Thanks
Sanchita
Mar 27 '07 #2
Hi sanchita,

This has been a change in ASP.NET 2.0. If you don't specify
CreatePersistantCookie the cookie times out. If you do, then the timeout
value is what determines the cookie timeout even if you create a persistent
cookie.

This differs from ASP.NET 1.x which created a cookie with a long expiration
date - in 2.0 the expiration date is based on the timeout.

IOW, you need to set thte timeout value to a large number if you want a true
persistent cookie.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com/weblog
"sanchita" <sa******@fareportal.comwrote in message
news:OS****************@TK2MSFTNGP04.phx.gbl...
Hello everyone,

I didn't get any response in "Security" forum hence posting here again.

I am having problem with persistent cookies. Even after setting
"CreatePersistentCookie" to true in "FormsAuthentication.SetAuthCookie"
I'm
being logged out after the specifed timeout provided in "forms"
element of web.config.

I read somewhere that lifetime of persistent cookies depend on the timeout
attribute on the forms authentcation node. If I have to enter a timeout of
days/weeks then it doesnt really make sense to make my cookie persist in
this fashion, that defies the purpose of persistent cookies.

Any insights welcome
Thanks
Sanchita
Mar 27 '07 #3
Yes I know that they arent used for session management. Since persistent
cookies arent working the way they were in asp.net 1.1, wherein what used to
happen was the framework itself had set the timeout for a persistent cookie
for days, we didn't have a control over it. However in asp.net 2.0 we can
set the timeout for persistent cookies in our configuration. But the funny
thing is no matter if you want the cookie to be persistent or
non-persistent, both will acquire this timeout value. So it leaves me no
choice but to set one. Scott Gutherie from Microsoft also verifed on this to
us.

Although I'm working out my options and not just setting the timeout value
to a huge number. For the record I'm using Dotnetnuke 2.4 and facing this
problem since I shifted to asp.net 2.0. However my Team leader tells me that
in DNN 4.0 persistent cookies work fine despite the default timeout.

Thanks
Sanchita
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:AD**********************************@microsof t.com...
You miss the purpose of persistant cookies. They are not used for session
management, they are used for authentication.

A persistent cookie is designed to allow the user to access a secured site
without having to log in again when he hits the site the second time. It
persists the authentication on the client side so it is sent with the
header. The system then automatically logs him in.

Session timeout is a part of your application. While the cookie can
"re-log on" the user if he times out, it cannot change the timeout
behavior on the server just because the user has a cookie.

For the record, you should NOT increase timeout to days. That defeats the
purpose of session management. What you can do is kick the user back to
the start page and abandon session, forcing the timeout. You then provide
a link on the timeout page. This can be a dynamic link back to where he
was working, if you desire. The user will then be logged back in, as the
cookie is there.

This may not be what you envision and make you think you want to increase
session time until the year 2010. Here is why. The session timeout is how
long the server keeps objects in session, meaning in memory on the server.
You set a really long timeout, say two weeks out. That session is now open
for two weeks. User's computer crashes and he opens the browser and hits
your site. You now have 2 two-week sessions for one user. After some work,
the user shuts down and then opens the browser again and hits the site.
You now have 3 two-week sessions for one user. This can go on until you
use all of the memory on the server with just a couple of users.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"sanchita" <sa******@fareportal.comwrote in message
news:OS****************@TK2MSFTNGP04.phx.gbl...
>Hello everyone,

I didn't get any response in "Security" forum hence posting here again.

I am having problem with persistent cookies. Even after setting
"CreatePersistentCookie" to true in "FormsAuthentication.SetAuthCookie"
I'm
being logged out after the specifed timeout provided in "forms"
element of web.config.

I read somewhere that lifetime of persistent cookies depend on the
timeout
attribute on the forms authentcation node. If I have to enter a timeout
of
days/weeks then it doesnt really make sense to make my cookie persist in
this fashion, that defies the purpose of persistent cookies.

Any insights welcome
Thanks
Sanchita

Apr 5 '07 #4

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

Similar topics

0
by: benny | last post by:
Hi, I used following procedure to created the cookies:- FormsAuthentication.RedirectFromLoginPage(IntToStr(BizCustomerID), wchkRememberLogin.Checked); I found that the setting on web.config...
2
by: benny | last post by:
Hi, I tried the following method to add persistent cookies :- HttpCookieCollection MyCookieCollection = new HttpCookieCollection(); HttpCookie MyCookie = new HttpCookie("LastVisit");...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
4
by: Joey Powell | last post by:
Hello, I originally configured my application to use persistent cookies in error. Now, I need to find a way to disable those cookies. I have tried changing usernames and passwords for all of the...
1
by: Marco Rispoli | last post by:
I am using this function to write a cookie: private static void SaveCookie(string CookieName, string CookieValue, bool Persistent) { HttpContext.Current.Response.Cookies.Value = CookieValue;...
1
by: hochun | last post by:
I am trying to read non-persistent cookies that is not reading in the program coding is there any software thich can read it (just like Cookie Monster, but it can't read non-persistent cookies ) ...
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,...
9
by: mel | last post by:
Hi all, I need a persistent TCP connection with my web server over page reloads. This means that, even if the user goes to a different page (in my domain), I want to keep a TCP connection...
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...
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
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...
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.