Login page redirect to Recover password?

0

I am making an application in ASP .NET where I am logging in with drivers. However in the login page when I click on the hyperlink to make recover password the control does not leave the login page and I am not redirected to the page of recover password. If I see the URL it changes the url to recoverpassword.aspx but the recover page does not appear and I do not leave the login page. Can someone help me figure out why? Thank you.

Code in the default.aspx page:

public partial class _Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.User.Identity.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
        }
        else if (this.Page.User.IsInRole("Saba") || this.Page.User.IsInRole("CorpAdmin") )
        {
            //Server.Transfer("Report/ListSabaReports.aspx", true);
            Response.Redirect("~/Report/ListSabaReports.aspx");
        }
        else if (this.Page.User.IsInRole("SumTotal"))
        {
            //Server.Transfer("Report/ListSumTotalReports.aspx", true);
            Response.Redirect("~/Report/ListSumTotalReports.aspx");
        }
        else if (this.Page.User.IsInRole("X-Domain"))
        {
            //Server.Transfer("Report/ListSabaReports.aspx", true);
            Response.Redirect("~/Report/ListSabaReports.aspx");
        }
    }
}

Code in web config:

                                                                                                                                                                                                                                                                          

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
      assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </controls>
</pages>

                                                                                                                                                                                                                                               

I WANTED TO BE AT THE LOGIN PAGE THAT I HAVE THERE A HYPERLINK WITH THE TEXT RECOVERPASSWORD AND I WANTED TO BE REDIRECTED TO THIS PAGE BUT I CAN NOT ALWAYS BE ON THE LOGIN PAGE. SOMEBODY HELP ME

    
asked by anonymous 05.04.2016 / 01:48

1 answer

1

The causes can be several:

If a controller or method is decorated with the Authorize annotation, the system redirects to the login page.

I would put a breakpoint on the controller and debug it to see what code it runs.

Edit:

if (!this.Page.User.Identity.IsAuthenticated)
    {
        FormsAuthentication.RedirectToLoginPage();
    }

The code above says that if the user is not authenticated he is redirected to the login page.

Normally the password recovery link is available to users who have not logged in, because if they did, they would use the change password option, right?

Now if the user clicks on recover password is not yet authenticated the code above runs and is always redirected to the login page!

    
05.04.2016 / 12:14