Ask a Question related to ASP.NET Security, Design and Development.
-
Nico den Boer #1
Newbee question; form authentication
Hello all,
I have a problem with retrieving roles.
In the login form, I do the following things;
- Retrieve roles (string, format like "Administrator|User|Guest")
- Create a FormsAuthenticationTicket with these roles as parameter
- Crypt the thicket, create a cookie with this ticket
- Store the cookie in the response / session
(traced / debugged this part, works fine)
In the global.asax.cs, method Application_AuthenticateRequest, I:
- Retrieve the cookie, decrypt it, split the roles into an array
- Create a new FormsIdentity object, IPrincipal object and store that one to
Context.User
For this, I followed the instructions in
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod18.asp[/url]
In a all user forms, I can now extract the username via
Context.User.Identity.Name
That works fine.
The problem is now that the roles are lost somewhere, somehow. It's like
magic...
Tracing everyting, retrieving and decrypting the cookie works fine, but
authTicket.UserData is an empty string.
Now where are my roles ?
Any help would be greatly appriciated.
Kind regards, Nico
Nico den Boer Guest
-
newbee question
Hi folks! i'm new to flash and started experimenting a little bit. I know by now how to create a button, and while surfing I came across this... -
Beginners question: Form based authentication
Hello, the following question may be trivial, but after scrolling documentations on my screen for hours I'd absolutely appreciate your help: I... -
authenticate win32 form client with form based authentication web services
(Type your message here) -------------------------------- From: kitchai yong Hi, Can you tell me how i authenticate the win32 form client... -
newbee help with php please
hi I'm just started on the MySQL + PHP road. I have installed MySQL + MySQL_CC + dbtools and made a MySQL-database with all the data from one... -
Form based authentication question
I understand that in the web.config file I can have the following: <location path="MembersOnly"> <system.web> <authorization> <allow... -
Hernan de Lahitte #2
Re: Newbee question; form authentication
Hi Nico,
Perhaps your problem is with the max lenght of your user data string that
you are storing inside the cookie.
Here is a post that will show some details about this.
[url]http://weblogs.asp.net/hernandl/archive/2004/07/30/FormsAuthRolesRev.aspx[/url]
And there is another one that explains some perf. gains when using this
approach for role authz with forms.
[url]http://weblogs.asp.net/hernandl/archive/2004/08/05/FormsAuthRoles2.aspx[/url]
Regards,
Hernan.
--
Hernan de Lahitte
[url]http://weblogs.asp.net/hernandl[/url]
"Nico den Boer" <nicodenboer@home.nl> escribió en el mensaje
news:uW%23KJUowEHA.4028@TK2MSFTNGP15.phx.gbl...> Hello all,
>
> I have a problem with retrieving roles.
>
> In the login form, I do the following things;
> - Retrieve roles (string, format like "Administrator|User|Guest")
> - Create a FormsAuthenticationTicket with these roles as parameter
> - Crypt the thicket, create a cookie with this ticket
> - Store the cookie in the response / session
>
> (traced / debugged this part, works fine)
>
> In the global.asax.cs, method Application_AuthenticateRequest, I:
> - Retrieve the cookie, decrypt it, split the roles into an array
> - Create a new FormsIdentity object, IPrincipal object and store that one
> to
> Context.User
>
> For this, I followed the instructions in
> [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod18.asp[/url]
>
> In a all user forms, I can now extract the username via
> Context.User.Identity.Name
> That works fine.
>
> The problem is now that the roles are lost somewhere, somehow. It's like
> magic...
> Tracing everyting, retrieving and decrypting the cookie works fine, but
> authTicket.UserData is an empty string.
>
> Now where are my roles ?
> Any help would be greatly appriciated.
>
> Kind regards, Nico
>
>
Hernan de Lahitte Guest
-
Nico den Boer #3
Re: Newbee question; form authentication
Thanks Hernan,
I've read the articles, they are very useful !
Kind regards,
Nico
Nico den Boer Guest



Reply With Quote

