How to make ASP.NET authentication persist the Url Fragment when redirecting to the login page?

Posted by estourodepilha.com on Stack Overflow See other posts from Stack Overflow or by estourodepilha.com
Published on 2010-04-09T20:02:11Z Indexed on 2010/04/09 20:03 UTC
Read the original article Hit count: 565

Filed under:
|
|
|
|

After I inserted the configuration below in my Web.Config

<authentication mode="Forms">
  <forms name="appNameAuth"
   path="/" loginUrl="login.aspx" protection="All" timeout="30">
    <credentials passwordFormat="Clear">
      <user name="user" password="password" />
    </credentials>
  </forms>
</authentication>
<authorization>
  <deny users="?" />
</authorization>

All requests to

Menu.aspx#fragment

are redirected to

login.aspx?ReturnUrl=/Menu.aspx

and I expected it to be redirected to

login.aspx?ReturnUrl=/Menu.aspx#fragment

How to achieve the desired behavior?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .NET