Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having to login twice to asp.net application due to "Default Document" in IIS

Previously, I had added login.aspx to the Default Document section in IIS.

However, when someone was accessing the application, it was required to login twice. The first one wouldn't say any error message or no redirection to the next page in the application. And the second one would actually redirect the user to the expected page. And the user was using the right credentials both times.

As soon as I deleted login.aspx from the Default Document section in the IIS, and the user provided the full link to the application (~/login.aspx), the problem was gone as it was only required to login once.

Does anyone know why this is happening?

like image 520
aleafonso Avatar asked Nov 14 '22 01:11

aleafonso


1 Answers

In order to solve this problem, in the Page_Load event of the Default Document, it must be checked the following:

if (this.User.Identity.IsAuthenticated)
{
    Response.Redirect("somepage.aspx");
}

Source: asp.net Form Authentication change .net 2 to .net4

like image 169
aleafonso Avatar answered Jan 05 '23 15:01

aleafonso