Asp.net authentication redirection issue

The document feature is disabled by default in IIS, and here's the situation ...

My start page for my project is A.aspx. I am running a project and pretty sure A.aspx appears in the browser url. As it should be, A.aspx does not detect that the user is not registered and is redirected to Login.aspx, as it should.

A.aspx:

    if (Session["UserStuff"] == null)
        Response.Redirect("~/Account/Login.aspx"); 

The login.aspx window appears, but when the user logs in, the code:

FormsAuthentication.RedirectFromLoginPage (txtUserName.Text, true);

always redirects to "Default.aspx", not "A.aspx"

I have studied FormsAuthentication.GetRedirectUrl and am sure it returns "Default.aspx"

Am I at a dead end ????

+3
source share
4 answers

web.config defaultUrl:

<authentication mode="Forms">
    <forms 
       loginUrl="login.aspx" 
       defaultUrl="a.aspx"
       protection="All"  
       timeout="30" 
    />
</authentication>
+6

FormsAuthentication, web.config. , web.config DefaultUrl. . FormsAuthentication . SignOut(), , FormsAuthentication .

0

, , URL- , , URL- , . , : http;//bob/login.aspx, http;//bob/showmethemoney.aspx, http;//bob/login. ASPX? ReturnUrl = showmethemoney.aspx. , ReturnUrl , , .

0

Source: https://habr.com/ru/post/1759655/


All Articles