0

I am using following code to create a authentication cookie, but the problem is user is not getting authenticated. Please let me know if I am missing somthing.

HttpCookie authCookie = FormsAuthentication.GetAuthCookie(UserLogin.UserName, true);
               FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
               FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, userDataString);
               authCookie.Value = FormsAuthentication.Encrypt(newTicket);
               Request.Cookies.Add(authCookie);
               string url =  FormsAuthentication.GetRedirectUrl(UserLogin.UserName, true);
               Response.Redirect(url);
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by dnanetwork
0

http://www.asp.net/learn/security/tutorial-03-cs.aspx

try this...

one more thing UserLogin.UserName instead of this

manually write your name

#
FormsAuthentication.GetRedirectUrl("Jigsaw", true);
#
Response.Redirect(url);

and after redirection on page load check

if(Request.IsAuthenticated)
if yes then

UserLogin.UserName is nothing..

make a check and let me know the o/p

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.