Redirect to someone else's page! Like the header states - I have a web.config file that look...">

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
source share
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

loginUrl , , -.

:

loginUrl="~/login"

loginUrl="/login"
+1

loginUrl="login"

URL- . URL- - "Login.aspx", , .

loginUrl="login.aspx"

, ReturnURL, , .

0

LoginUrl UrlPath.Combine(HttpRuntime.AppDomainAppVirtualPathString, loginUrl);, , "".

http://www.ureader.com/msg/15372322.aspx

0
source

Source: https://habr.com/ru/post/1759218/


All Articles