Ask a Question related to ASP.NET Security, Design and Development.
-
Gilles Lambert #1
Re: Loosing roles between two pages ?
Ok Thanks,
Here is what i've found in MS Press literature and it's ok :
If FormsAuthentication.Authenticate( _
txtNom.Text, txtMP.Text) Then
Dim sRoles As String = "Ut;R1;R2"
Dim Fat As New FormsAuthenticationTicket(1, _
txtNom.Text, DateTime.Now, _
DateTime.Now.AddMinutes(60), False, sRoles)
Dim sFatCrypte As String = _
FormsAuthentication.Encrypt(Fat)
Dim CookieAuth As New HttpCookie("TicketAuth", _
sFatCrypte)
Response.Cookies.Add(CookieAuth)
FormsAuthentication. _
RedirectFromLoginPage(txtNom.Text, False)
End If
And then, in another page :
Dim CookieAuth As HttpCookie = _
Request.Cookies("TicketAuth")
If CookieAuth Is Nothing Then
Exit Sub
End If
Dim fat As FormsAuthenticationTicket
Try
fat = FormsAuthentication. _
Decrypt(CookieAuth.Value)
Catch ex As Exception
lblMessage.Text = "Exception : " & ex.Message
End Try
If fat Is Nothing Then
lblMessage.Text = "Le décryptage a échoué."
Exit Sub
End If
lblMessage.Text = "Roles : " & fat.UserData
' Pour créer un objet Principal
' associé à la requête :
Dim fi As New FormsIdentity(fat)
Dim gp As New GenericPrincipal(fi, _
fat.UserData.Split(";"))
context.User = gp
Best regards ;-)
Gilles
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Gilles Lambert Guest
-
Property is loosing value
Hello NG, I've created a custom component inherited from "System.Web.UI.Webcontrold.Button" and added a new String Property .... Private... -
Loosing css?
Hi all! I have a problem with my datagrid and css. To fill my grid, I have a database connection. The sql is partly built from drop down lists... -
Roles based Forms Auth - denied pages redirect
I would like to know how, if at all possible, a custom redirect page can be setup for when a users role(s) are denied to a page. The default... -
XML loosing special chars
We have an XML file that is loading both English and Spanish to display on a screen. The word Yes or S? in Spanish looses the accent " ? ".. We... -
Loosing linked directory
After using smit install, I always loos my link to /usr/local and have to redo ln -s /home/local /usr/local. Any ideas ? --- Outgoing...



Reply With Quote

