Windows Forms Authentication - <deny users = "?" > Redirect to someone else's page!
Like the header states - I have a web.config file that looks like
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms name="login" protection="All" timeout="30" loginUrl="login" defaultUrl="~/">
<credentials passwordFormat="Clear">
<user name="admin" password="password" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
I want to do what he says he should do ... I want to refuse all users who are trying to enter the site.
It works, however, it redirects to the URL "Account / Login? ReturnUrl =% 2flogin", which I never heard of ...
Is there a place where I can change this?
+3
4 answers
I have seen this problem before. Sure, you also get this error:
401.2.: . - . , , -. - .
"/Account/Login", . , - , - MVC , - ASP.NET Forms. , Razor, web.config :
<appSettings>
<add key="webpages:Enabled" value="true" />
</appSettings>
, , :
<authentication mode="Forms">
<forms loginUrl="login" timeout="43200"/>
</authentication>
, "loginUrl" appSettings:
<appSettings>
<add key="webpages:Enabled" value="true" />
<add key="loginUrl" value="~/Login.aspx" /><!-- Override default -->
</appSettings>
+2