How to add FormsAuthenticationTicket to URL
- From: "ad" <flying@xxxxxxxxxxxxxxx>
- Date: Fri, 27 Jan 2006 15:18:56 +0800
The codes below is copy from msdn about FormsAuthenticationTicket.
It add FormsAuthenticationTicket to cookie.
How can I add the FormsAuthenticationTicket to URL not to Cookie?
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (Membership.ValidateUser(username, password))
{
string userData = "ApplicationSpecific data for this user.";
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
username,
DateTime.Now,
DateTime.Now.AddMinutes(30),
isPersistent,
userData,
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
// Create the cookie.
Response.Cookies.Add(new
HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectUrl(username,
isPersistent));
}
.
- Follow-Ups:
- Re: How to add FormsAuthenticationTicket to URL
- From: Sonu Kapoor
- Re: How to add FormsAuthenticationTicket to URL
- Prev by Date: Firefox Rendering Problems
- Next by Date: Re: ActiveX
- Previous by thread: Firefox Rendering Problems
- Next by thread: Re: How to add FormsAuthenticationTicket to URL
- Index(es):
Relevant Pages
|