Forms authentication pblm...
Basically iam using forms authentication in my project....
This is what my web.config looks like...
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<authentication mode="Forms">
<forms name="_MyAuthCookie" loginUrl="Login.aspx" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
in global.aspx section
In the forms authenticationsection iam checking like this....
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
HttpCookie authcookie = Request.Cookies[FormsAuthentication.FormsCookieName];
if (authcookie != null)
{
string cookiedata = authcookie.Value;
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookiedata);
string userdata = ticket.UserData;
XmlSerializer xs = new XmlSerializer(typeof(UserAuthInfo));
StringReader sr = new StringReader(userdata);
UserAuthInfo uai = (UserAuthInfo) xs.Deserialize(sr);
GenericIdentity iden = new GenericIdentity(ticket.Name);
Context.User = new GenericPrincipal(iden, uai.Roles);
Context.Items["UserAuthInfo"] = uai;
}
it is working fine... if i enter directly the second page of the form it is redirecting me to the login page. my problem is even iam having link in my login page for new user to register... even i click on that link it is redirecting me to the login page... iam not able to track where should i check it is from login page only... hope u got my problem.... plz help me in this..
thanks in advance
vishnu
|