views:

39

answers:

1

I am building onto the example found here:

http://www.mikesdotnetting.com/Article/126/ASP.NET-MVC-Prevent-Image-Leeching-with-a-Custom-RouteHandler

What I would like to do now is have some logic that checks for certain data in session before allowing the valid image to show. Is it possible to access session data from within the custom RouteHandler or any other type of persisted data?

+1  A: 

You have access the session right from the requestContext:

private static void ProcessRequest(RequestContext requestContext)
{
   var session = requestContext.HttpContext.Session;
jfar
I was getting null. Hmm. I'll try again. Thanks.
Brian David Berman
Does this work in MVC only? My session still comes out as null...
Shagglez