How to add FormsAuthenticationTicket to URL

A

ad

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));
}
 
S

Sonu Kapoor

Why would you want to add the authentication ticket to the URL? Why dont simply read it from the cookie?

Sonu Kapoor [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top