473,405 Members | 2,210 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,405 software developers and data experts.

FormsAuthentication ticket persistence

At the end of my login process I am generating my own Persistent
FormsAuthentication ticket.
I encode this and set a cookie value. I then use
Response.Cookies.Add(cookie), and
I continue the login process. The cookie is not persisted across sessions
and does not appear in the cookie list on the client.
If I use SetAuthCookie persistence works. What am I missing here, in not
getting the desired effect with my own ticket?

--
StanD
Nov 18 '05 #1
2 2701
Dim ticket As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, _
EmpID.ToString, _
DateTime.Now, _
DateTime.Now.AddHours(12), _
chkRememberLogin.Checked, _
Roles)

Dim cookie As HttpCookie = New
HttpCookie(FormsAuthentication.FormsCookieName)
cookie.Value = FormsAuthentication.Encrypt(ticket)

If (chkRememberLogin.Checked) Then cookie.Expires =
ticket.Expiration ' do you have this line???

HTH,
Greg
"StanD" <St***@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
At the end of my login process I am generating my own Persistent
FormsAuthentication ticket.
I encode this and set a cookie value. I then use
Response.Cookies.Add(cookie), and
I continue the login process. The cookie is not persisted across sessions
and does not appear in the cookie list on the client.
If I use SetAuthCookie persistence works. What am I missing here, in not
getting the desired effect with my own ticket?

--
StanD

Nov 18 '05 #2


"Greg Burns" wrote:
Dim ticket As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, _
EmpID.ToString, _
DateTime.Now, _
DateTime.Now.AddHours(12), _
chkRememberLogin.Checked, _
Roles)

Dim cookie As HttpCookie = New
HttpCookie(FormsAuthentication.FormsCookieName)
cookie.Value = FormsAuthentication.Encrypt(ticket)

If (chkRememberLogin.Checked) Then cookie.Expires =
ticket.Expiration ' do you have this line???

HTH,
Greg
"StanD" <St***@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
At the end of my login process I am generating my own Persistent
FormsAuthentication ticket.
I encode this and set a cookie value. I then use
Response.Cookies.Add(cookie), and
I continue the login process. The cookie is not persisted across sessions
and does not appear in the cookie list on the client.
If I use SetAuthCookie persistence works. What am I missing here, in not
getting the desired effect with my own ticket?

--
StanD

cookie.expires is key. thanks greg. Of course the ticket expiration is subject to change depending on the session durations , so the cookie life has to be made sufficiently large or adjusted.


Thanks again

Nov 18 '05 #3

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

Similar topics

4
by: Jeff B | last post by:
I am having a very perplexing problem with setting the user's roles. I have tried to figure this out for 2 days now. When the user logs in to the site, I retrieve the roles from the database and...
2
by: Grant Merwitz | last post by:
Hi, i am using forms authentication in an ASP.NET project I am setting the Forms authentication cookie by using: FormsAuthentication.RedirectFromLoginPage(UserName.Text, false); Now when i...
4
by: Matthias S. | last post by:
Hi there, I've created an application which is using Forms-based authentification. My Login-Button event handler looks somewhat like this: // validate the input, etc... // sUserName holds now...
0
by: Mike | last post by:
We want to use FormsAuthenticationTickets as part of our ASP.NET security. The current design stores the user's ticket in the db, and later uses the ticket to extract other data from the database....
5
by: Ĺženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
8
by: Bill Henning | last post by:
Another developer and I have noticed that after upgrading to the ASP.NET 2.0 RTM release, when using: FormsAuthentication.SetAuthCookie(userName, true) That the cookie is no longer persisted,...
3
by: Mark Olbert | last post by:
FormsAuthentication.SignOut() removes the authorization ticket from a user (and the user's roles), but does not change the user's identity. I need to be able to either revert the user to the...
2
by: Max André Bündchen | last post by:
In a custom application the web methods receive a user ticket in Soap Headers. This web methods call many bussiness methods to access database, validate user rights and so on. Today I must pass the...
0
by: Rodrigo m. Ferreira | last post by:
Can you help me to solve the following problem? on my loggin page I have the code: protected void LoginButton_Click(object sender, EventArgs e) { if(Membership.ValidateUser(TXTUsuario.Text,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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...
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,...
0
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...

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.