Change authentication form asp.net.net 2 to.net4

Here is my form validation section from my web.config

<authentication mode="Forms">
  <forms name="security" path="/" loginUrl="default.aspx" protection="All" timeout="360" />
</authentication>

<authorization>
  <deny users="?" />
</authorization>

For some reason, after changing to .net 4 as my goal, users need to log in twice before my forwarding is verified. Does anyone else come across this.

My login is also on the home page, so I tried the following: I just need to make my login page public, but it did not work. Does anyone else have this problem?

Also I noticed that as soon as I am on my homepage, I get this in the url default.aspx? ReturnUrl =% 2f , if I remove the ReturnUrl parameter, it will then work to log in for the first time. But if ReturnUrl is in querystring, I need to log in twice the first time visiting the site.

default.aspx? ReturnUrl =% 2f

So, I added the page to public access in my places, and this did not help ..

<location path="default.aspx">
<system.web>
  <authorization>
    <allow users="*" />
    <deny users="?" />
  </authorization>
</system.web>

+4
source share
2 answers

When is your url like this: default.aspx? ReturnUrl =% 2f, after logging in, it redirects back to the default page, which is the default page. If you added the code to the default page:

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

. , , .

+2

IIS Login.aspx. web.config , . IIS, . , IIS web.config, . , , , .

, loginurl = login.aspx defaulturl = pageafterlogin.aspx, .

+1
source

All Articles