Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
On MVC4, I'm implementing an attribute derived from "ActionFilterAttribute", but I need to get to data that's stored inside the user session for logging purposes

C#
public class MvcTraceAttribute: ActionFilterAttribute
{
    public override void OnActionExecuting(HttpActionContext actionContext)
    {
        // How do I get to HttpContext.Session["..."] from here?
    }
}


Any ideas?

Thanks
Eugene
Posted

1 solution

use System.Web.HttpContext.Current.Session
anywhere in ur project to access current session
 
Share this answer
 
v2
Comments
ehuysamer 1-Aug-12 5:19am    
I was trying to get to HttpContext via actionContext; didn't realize it was static!

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900