Sunday 15 March 2015

c# - redirect loop when redirecting to another page when logged in -


I am getting a redirect loop and I do not know why I have this simple code to be used so that if someone Go to default.aspx and if it is already logged in, then inside it. Why I am getting a redirect loop

  Public partial class _Default: System.Web.UI.Page {Protected Zero Page_Load (Object Sender, EventArgs e) {if (User.Identity.IsAuthenticated) // if the user is already logged in {Response.Redirect ("inside.aspx"); }}}   

EDIT:

Both pages share a master page with the following code, it closes only when the lockoff control is pushed The public partial square template: System.Web.UI.MasterPage {Protected Zero Page_Load (Object Sender, EventArgs e) {} Protected Zero LoginStatus1_LoggingOut (Object Sender, LoginCancelEventArgs e) {Response. Redirect ("default.aspx"); Session.Abandon (); }}

I agree that when you are trying to logout Redirecting the page to the default page is the reason that you are clearing the session after it is redirected, so the session.Abandon () is not called. But I do not know that your authentication is actually dependent on session. Aabandan () in which case you will see the redirect again. Secure zero log-inst_logging_aut (object sender, login casual eventErgus E) {session. Subdivision (); Response.Redirect ("default.aspx"); }

If you are using a subscription provider, see the default user, which can be configured to automatically redirect the user after logging out. To manually trigger logout, use FormsAuthentication.SignOut ().

No comments:

Post a Comment