PC Review


Reply
Thread Tools Rate Thread

Accessing Session Cache from GenericPrincipal.isInRole() Options

 
 
Richard Maher
Guest
Posts: n/a
 
      15th Sep 2010
Hi,

Can someone please confirm that Session Cache will not always be
available/accesible from an implemented/overriden IPrincipal.isInRole()
method?

We obtain the current session state via ((HttpApplication)sender).Session
but *sometimes* get the error "Session state is not available in this
context".

What appears to be happening is when isInRole() is invoked to check for
sitemap node access then Session State is available, but if the check is to
do with a web-page url then it is not. Eg: -

Web.sitemap

<siteMapNode roles="ROLE1,ROLE2,ROLE3"

Seems ok.

But when my IsInRole() is called to check the web-page URL access defined
in web.config eg: -

Web.config

<location path="MyPage.aspx">
<system.web>
<authorization>
<allow roles="CHS_M_AccessThisStuff"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

The exception is raised.

I'd like to not have to re-load the user roles from the database each time
the isInRole method is invoked after its GenericPrincipal has been
(re)instantiated and Session Cache seemed a convenient place to hold them
with the added benefit of implicit, transparent, lifecycle management.

There is always Application Cache or just using the database buffers, but if
someone could rule out Session cache for us altogether that would help. A
pointer to the manual or a relevant MSDN article would be perfect!

Cheers Richard Maher

 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Session Cache from GenericPrincipal.isInRole() Richard Maher Microsoft C# .NET 2 15th Sep 2010 04:08 AM
Toggle GridView Delete Link based on User IsInRole Options Dave Microsoft C# .NET 0 25th Oct 2009 10:09 PM
2.0: Cache vs Session RAM Microsoft ASP .NET 2 14th Aug 2006 09:20 PM
Accessing Session variables when using SQL Server for Session state Michael Microsoft ASP .NET 3 30th Dec 2005 07:56 PM
Session VS. Cache Robir Microsoft ASP .NET 3 12th Mar 2004 01:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.