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