M
Matt
I have something weird hapenning on my forms authentication, which to me
seems to be straight out of the MS help files
After the user logs in, they shoul dbe redirected to the resource they were
trying to reach. But all that happens is that they are reirected back to the
login page.
From trial and error, I believe that the cookie is never being created and
written.
In case this is an issue, my Browser has minimum security, and allows
cookies, and my firewall is turned off.
So, is the code below sufficient for my task, and if so, any more ideas as
to why it might not be working?
Matt
seems to be straight out of the MS help files
After the user logs in, they shoul dbe redirected to the resource they were
trying to reach. But all that happens is that they are reirected back to the
login page.
From trial and error, I believe that the cookie is never being created and
written.
In case this is an issue, my Browser has minimum security, and allows
cookies, and my firewall is turned off.
So, is the code below sufficient for my task, and if so, any more ideas as
to why it might not be working?
Matt
Code:
FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToString(),f
alse,10);
//Encrypt the ticket
string eT = FormsAuthentication.Encrypt(authTicket);
//Create a Cookie and store the data
HttpCookie authCookie = new
HttpCookie(FormsAuthentication.FormsCookieName,eT);
DateTime dt = DateTime.Now;
authCookie.Expires = dt.AddHours(1);
Response.Cookies.Add(authCookie);
//Redirect to Originally Requested Page
Label2.Text = (FormsAuthentication.GetRedirectUrl
(selectCMD.Parameters["@output"].Value.ToString(),false));
Response.Redirect(FormsAuthentication.GetRedirectUrl
(selectCMD.Parameters["@output"].Value.ToString(),false))