I'm trying to register a global filter in global.asax, I basically just want some code to run on every page to check some session variables, so if anyone knows a better way of doing it that would be great...
I've followed the same principal as registering routes but my code in my overriden OnApplicationStarted never seems to get executed
this is the contents of global.asax.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.Security; using System.Web.SessionState; using MyApp.Filters;
namespace MyApp { public class MyApp : Umbraco.Web.UmbracoApplication {
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); }
I got this to work in the end, I was already using StructureMap for dependency injection of an interface to some external data models, StructureMap had created a
class in the App_Start folder with a Start() method so i moved my RegisterGlobalFilters method to this class and added the filters in the Start() method.
In my ActionFilter class I'm overriding OnActionExecuting instead of OnResultExecuting - but i'm not sure which is right here....
MVC Register Global Filter -Umbraco 6.04
Hi
I'm trying to register a global filter in global.asax, I basically just want some code to run on every page to check some session variables, so if anyone knows a better way of doing it that would be great...
I've followed the same principal as registering routes but my code in my overriden OnApplicationStarted never seems to get executed
this is the contents of global.asax.cs
I got this to work in the end, I was already using StructureMap for dependency injection of an interface to some external data models, StructureMap had created a
class in the App_Start folder with a Start() method so i moved my RegisterGlobalFilters method to this class and added the filters in the Start() method.
In my ActionFilter class I'm overriding OnActionExecuting instead of OnResultExecuting - but i'm not sure which is right here....
is working on a reply...