Last post Jul 28, 2011 03:17 AM by s4lin4u
Jul 17, 2011 01:34 AM|s4lin4u|LINK
Im facing problem as its not direction appropriate page after session clear.
Response.Cache.SetCacheability(HttpCacheability.NoCache); Session.Abandon(); Session.RemoveAll(); Session.Clear(); FormsAuthentication.SignOut(); Response.Redirect("Home.aspx");
Thanks in Advanced,
Jul 17, 2011 02:29 AM|kedarrkulkarni|LINK
it might be that u r trying to redirect to Home.aspx while u r being redirected to login.aspx
if u r using forms authnetication then after session abandon and making user logout from app, user has to login again...
the setting is there in the web.config... something like this
i.e. if login.aspx is set as loginurl in web.config then after session.abandon user will always be redirected to login.aspx even if u try to redirect to any other page
read this for more info
hope this helps...
Jul 17, 2011 11:26 AM|s4lin4u|LINK
im getting error Redirect Loop
browser has detected that the server is redirecting the request for this address in a way that will never complete.
<authentication mode="Forms"> <forms loginUrl="Home.aspx" timeout="2880" name=".ASPXFORMS" protection="All" path="/" defaultUrl="Dashboard.aspx" requireSSL="false"/> </authentication>
Jul 18, 2011 07:45 AM|manimaransr|LINK
Please try to add the below code in Global.asax
protected void Application_AuthenticateRequest(object sender, EventArgs e)
// look if any security information exists for this request
if (HttpContext.Current.User != null)
// see if this user is authenticated, any authenticated cookie (ticket) exists for this user
// see if the authentication is done using FormsAuthentication
if (HttpContext.Current.User.Identity is FormsIdentity)
// Get the roles stored for this request from the ticket
// get the identity of the user
FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity;
// get the forms authetication ticket of the user
FormsAuthenticationTicket ticket = identity.Ticket;
// get the roles stored as UserData into the ticket
string roles = ticket.UserData.Split(',');
// create generic principal and assign it to the current request
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(identity, roles);
Jul 18, 2011 10:12 AM|s4lin4u|LINK
Thanks for showing intrest.
I have tried with same code in global.apsx.cs as u said, now url shows home.aspx but taken long time and issue is presists.
Jul 18, 2011 04:09 PM|budugu|LINK
Jul 21, 2011 04:17 AM|Mamba Dai - MSFT|LINK
I have built a simpest sample according to your information. Fortunately I can redirect to Home page after clearing Seesion and signing out using the following code snippet.
I suggest you to confirm if the Home.aspx is accessable to anonymous user. And you need to grasp what is the difference among Session.Abandon(), Session.RemoveAll and Session.Clear(). Please check this link:
The Seesion_End event will be fired when you call the Session.Abandon method. I suggest you don't use the three methods meantime. Just use one of them based on your practice.
Jul 28, 2011 03:17 AM|s4lin4u|LINK
I followed manimanran instruction and i have done small changed in redirection page as default.aspx instead of home.aspx, since my web hoster provided as default.aspx as default page.