Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > HELP: Cookie keeps expiring!

Reply
Thread Tools

HELP: Cookie keeps expiring!

 
 
VB Programmer
Guest
Posts: n/a
 
      11-03-2003
I have a login page that creates a cookie. The expiration time (in seconds)
is in a string in web.config. The problem is that I have to keep logging in
after only a few minutes. Any ideas? Here's portions of my cookie code...

Dim ctxMyContext As HttpContext = HttpContext.Current
Dim fatTicket As New FormsAuthenticationTicket( _
1, txtUserName.Text.ToUpper.Trim, DateTime.Now, _
DateTime.Now.AddMinutes(30), False, strUserData)
Dim strCookieValue As String =
FormsAuthentication.Encrypt(fatTicket)
Dim cookieMyCookie As HttpCookie = New
HttpCookie(FormsAuthentication.FormsCookieName)
Dim strReturnUrl As String

' Create custom cookie
With cookieMyCookie
.Path = FormsAuthentication.FormsCookiePath
.Value = strCookieValue
.Expires =
DateTime.Now.AddMinutes(CType(ConfigurationSetting s.AppSettings("CookieExpir
ationMinutes"), Double))
End With
ctxMyContext.Response.Cookies.Add(cookieMyCookie)

Thanks,
Robert


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cookie Question (IP as domain and cookie file location) =?Utf-8?B?UGF1bA==?= ASP .Net 1 01-10-2006 08:37 PM
Any downsides to cookie assignment inside custom class using HttpContext.Current? ASP.NET 2.0 cookie fix? ASP .Net 2 08-17-2005 06:43 AM
Cookie and Session Cookie Questions. Shapper ASP .Net 1 04-27-2005 11:20 AM
Have a Javascript that keeps a cookie on a popup Connie Walsh Javascript 3 09-22-2004 12:56 PM
Session cookie? Browser instance cookie? Ben ASP .Net 3 06-03-2004 03:41 AM



Advertisments