PC Review


Reply
Thread Tools Rate Thread

Appplication_AuthenticateRequest

 
 
Peter Morris
Guest
Posts: n/a
 
      9th Mar 2008
Hi all

First I want to say that I don't want to implement the membership providers.
I'm writing some specific documentation, and those come into it later :-)

I am using Forms authentication in a website. I want access to different
areas based on roles. When the user logs in I determine their roles as a
string[]. The problem is that to set those roles for Forms authentication I
need to create the new System.Security.Principal.GenericPrincipal in
Application_AuthenticateRequest.

The problem with this is that the Session[] is null. In the past I have
stored the role information in Application[], but if I want to move my
session state into a DB so that my site can be farmed my Application[] will
not get carried across will it?

So, what should I do?


Thanks

Pete


 
Reply With Quote
 
 
 
 
Peter Morris
Guest
Posts: n/a
 
      9th Mar 2008
Looks like I will have to store it in a DB.


 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      10th Mar 2008
If you are using Forms Authentication, you can create the Forms ticket
programmatically and store the user's role(s) info as a delimited string in
the userData property of the ticket. Since this is serialized into the Forms
auth cookie and can be read back out on each request, there is no need for
Session.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"Peter Morris" wrote:

> Hi all
>
> First I want to say that I don't want to implement the membership providers.
> I'm writing some specific documentation, and those come into it later :-)
>
> I am using Forms authentication in a website. I want access to different
> areas based on roles. When the user logs in I determine their roles as a
> string[]. The problem is that to set those roles for Forms authentication I
> need to create the new System.Security.Principal.GenericPrincipal in
> Application_AuthenticateRequest.
>
> The problem with this is that the Session[] is null. In the past I have
> stored the role information in Application[], but if I want to move my
> session state into a DB so that my site can be farmed my Application[] will
> not get carried across will it?
>
> So, what should I do?
>
>
> Thanks
>
> Pete
>
>
>

 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      10th Mar 2008
Where does that get stored between requests?


 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      10th Mar 2008
In the forms cookie. here's an article with some sample code:
http://www.eggheadcafe.com/articles/20020906.asp
Peter

Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"Peter Morris" wrote:

> Where does that get stored between requests?
>
>
>

 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      11th Mar 2008
It's as I thought, the roles are stored in a cookie on the client. Just how
safe is this against modification?

Pete


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 PM.