locked
Owin StartPage! RRS feed

  • Question

  • User-1101529841 posted

    Hi,

    I have Owin but i have 3 places where i ask for username and password. the startup page used in Owin Authentication. Is there a way in the startup file (or create more than one file) as it might be annoying for users to have to go to the startup page as they know the page they want to go to!

    In Short, I  have main.aspx, forever.aspx and frederic.aspx --- they all have login screen but Owin will consider main.aspx (for Authentication) and will not allow the users to login the other pages unless they visit main.aspx first!

     public void Configuration(IAppBuilder app)
        {
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
    
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Main.aspx"),
    
            });
        }

    Thanks.

    Thursday, May 5, 2016 9:32 PM

Answers

  • User614698185 posted

    Hi ramiwahdan,

    According to your description, I think you want to redirect to previous page after login. If so, you could use redirect user with QueryString "ReturnUrl" and get the url of the page, like below:

    if (Request.QueryString["ReturnUrl"] != null)
    {
         Response.Redirect(Request.QueryString["ReturnUrl"].ToString());
    }
    else
    {
         Response.Redirect("WelcomePage-OR-HomePage.aspx");
    }

    Best Regards,

    Candice Zhou

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 6, 2016 2:59 AM