Allow / Deny User does not work correctly

0

I can not get security on a website. In the web config Raiz I put the following line:

<authorization>
  <deny users="?" />
</authorization>

Then, in the "Account" folder, I have the following web.config :

<?xml version="1.0"?>
<configuration>
  <location path="Register.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
       </authorization>
    </system.web>
  </location>
  <location path="~/Account/Manage.aspx">
    <system.web>
      <authorization>
       <deny users="?"/>
      </authorization>
    </system.web>
  </location>
</configuration>

Just like this post, I can not go to the page Register.aspx , I miss an error of Persmisos.

*Acceso denegado.
Descripción: Error al obtener acceso a los recursos necesarios para completar esta solicitud. Puede que el servidor no esté configurado para obtener acceso a la dirección URL solicitada. 
Mensaje de error 401.2.: No autorizado: error al iniciar sesión debido a la configuración de servidor. Compruebe que tiene permiso para ver este directorio o página con las credenciales que ha suministrado y los métodos de autenticación habilitados en el servidor Web. Póngase en contacto con el administrador del servidor Web para obtener más ayuda.*

If I delete the% main_code% line web.config enter all the pages correctly, that is, the page is walking, only blocked by this "security".

If I remove the deny users="?" from the "Account" folder when I want to login it redirects me to the login page, as established by the authentication in the root webconfig.

    
asked by NioDeTark 03.10.2016 в 15:16
source

1 answer

2

Try using this to sign in:

<?xml version="1.0"?>
<configuration>
  <location path="Register.aspx">
    <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="~/Account/Manage.aspx">
    <system.web>
       <authorization>
          <deny users="?"/>
          </authorization>
     </system.web>
  </location>
    <system.web>
       <authorization>
            <allow roles="Administrador"/>
            <deny users="*"/>
       </authorization>
    </system.web>
 </configuration>

With this last line you block all pages and subdirectories unless they fulfill Administrator roles.

More examples in this league .

Easy to understand Microsoft technical guidelines in this league .

    
answered by 03.01.2017 / 23:54
source