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
Post a Comment