Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/02/2011, 13:39
Avatar de gedarufi
gedarufi
 
Fecha de Ingreso: diciembre-2008
Ubicación: Colombia
Mensajes: 540
Antigüedad: 15 años, 5 meses
Puntos: 22
Respuesta: Denegar pegar link en navegador

Cita:
Iniciado por lbauerle Ver Mensaje
podrias mostrarme un poquito de codigo pliss?


THX.
Claro que si, tu web.config debe de quedar asi:

Código XML:
Ver original
  1. <?xml version="1.0"?>
  2. <configuration>
  3.   <configSections>
  4.   </configSections>
  5.   <location path="Backstage">//Ruta raiz que quieres proteger
  6.     <system.web>
  7.       <authorization>
  8.         <deny users="?" />
  9.       </authorization>
  10.     </system.web>
  11.   </location>
  12.   <connectionStrings>
  13.   </connectionStrings>
  14.   <appSettings>  
  15.   </appSettings>
  16.   <system.web>
  17.     <!--
  18.            The <authentication> section enables configuration
  19.            of the security authentication mode used by
  20.            ASP.NET to identify an incoming user.
  21.        -->
  22.     <authentication mode="Forms">
  23.       <forms name=".Default" loginUrl="Backstage\Login.aspx" protection="All" timeout="15" />//Ruta del formulario de autenticación (Inicio de sesión)
  24.     </authentication>
  25.     <!--
  26.            The <customErrors> section enables configuration
  27.            of what to do if/when an unhandled error occurs
  28.            during the execution of a request. Specifically,
  29.            it enables developers to configure html error pages
  30.            to be displayed in place of a error stack trace.      
  31.        -->
  32.   </system.web>
  33.   <system.webServer>
  34.     <modules>
  35.     </modules>
  36.   </system.webServer>
  37. </configuration>

En el formulario de inicio de sesión me imagino que realizaras alguna validación del usuario, pero ademas debes de agregar el siguiente código:

Código C#:
Ver original
  1. e.Authenticated = [Validar usuario]
  2.  
  3. if (e.Authenticated)
  4. {
  5.     FormsAuthentication.RedirectFromLoginPage([USER NAME], [RECORDARME]);
  6. }

Eso es lo básico, si tienes dificultades no dudes en preguntar.

Saludos

Última edición por gedarufi; 18/02/2011 a las 13:41 Razón: Corrección en el código