c# - ASP.NET Redirect to Https issue - Error 401 -


we have implemented https our website, have made implement redirect.

       <rewrite>             <rules>                 <rule name="rule - name" enabled="true" stopprocessing="true">                     <match url=".*" />                     <conditions>                         <add input="{https}" pattern="off" />                     </conditions>                     <action type="redirect" url="https://yourpath" redirecttype="youttype" />                 </rule>             </rules>         </rewrite> 

the redirect working ok, got issue. of users has saved in bookmarks old path http://applicationname/account/login?returnurl=%2f , redirect doing -> https://applicationname/?returnurl=/ , error can see below:

401 - unauthorized: access denied due invalid credentials. not have permission view directory or page using credentials supplied.

so far have tried fix issue add appsetting in web.config stuff saw solve problem:

<appsettings>   <add key="autoformsauthentication" value="false" />   <add key="enablesimplemembership" value="false"/> </appsettings> 

and

<authorization>   <allow users="*"/> </authorization> 

but still having same issue redirect. idea how can fix issue??

thanks!!

try building url based on match rather statically:

<rule name="http https redirect" stopprocessing="true">   <match url="(.*)" />     <conditions>       <add input="{https}" pattern="off" ignorecase="true" />     </conditions>   <action type="redirect" redirecttype="found" url="https://{http_host}/{r:1}" /> </rule> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -