en el Web.Config, y se aplicara a la carpeta en donde se encuentre el Web.Config
<configuration>
<system.web>
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/"/>
</authentication>
<authorization>
<allow roles="perfil_1,...,perfil_n"/>
<deny users="*"/>
</authorization>
<system.web />
<configuration />
para mas informacion:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfForms.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfForms.asp
... despues cuando un usuario es aceptado...
...
PonerCookie(txtUsuario.Text.Trim)
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUsuario.Text.Trim, False)
...
Private Sub PonerCookie(ByRef sUserName As String)
Dim objTicket As System.Web.Security.FormsAuthenticationTicket
Dim objCookie As HttpCookie
Dim strReturnURL As String
objTicket = New System.Web.Security.FormsAuthenticationTicket(1, sUserName, Now(), #12/25/2002#, False, "")
objCookie = New HttpCookie(".ASPXAUTH")
objCookie.Value = System.Web.Security.FormsAuthentication.Encrypt(objTicket)
Response.Cookies.Add(objCookie)
End Sub
para mas informacion:
http://www.dotnetjohn.com/articles.aspx?articleid=8
y por ultimo, en el Global.asax...
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
If Request.IsAuthenticated Then
...
aqui buscas por el rol/perfil del usuario.
...
Context.User = New System.Security.Principal.GenericPrincipal(Context.User.Identity, array_de_roles|rol.Split("algun_caracter"))
End If
End Sub
esto sucede despues de
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUsuario.Text.Trim, False)
...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfForms.asp
...
en fin, eso es lo que yo hago, espero te sirva, si alguien sabe otra cosa, por favor comparta, todos queremos mejorar