Developer forum

Forum » Development » Custom MVC filter

Custom MVC filter

Karol Barkowski
Reply

hello,

I need to register a custom mvc filter. In a regular mvc app it is trivial and I can do it in the global.asax file. In DynamicWeb 9 however we don't have access to this and if I'm correct, the recommended approach is to use notification events to hook up into application lifecycle and customize it.

As far as I know, if I need a custom filter, I should use the "AfterDynamicwebStart" event, so I got a basic code like this:

    [Subscribe(Standard.Application.AfterDynamicwebStart)]
    public class OnAfterDynamicwebStart : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var argsMapped = args as Standard.Application.AfterDynamicwebStartArgs;
        }
    }

It is triggered correctly. But how exactly can I use those "BeforeStartArgs" to get into the app fliters collection and add something to it? I can't figure out this part.


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply
This post has been marked as an answer

Hi Karol,

I believe you may be looking for something like this: https://vimeo.com/217447832.
Let me know if indeed you are, or if additional information is needed.

BR
Snedker

Votes for this answer: 1
 
Karol Barkowski
Reply

Hi,

thank you for your answer. Altough this is not exactly what I initially needed but still that video was very informative and being able to hook up my own custom mvc project into DW will solve some of my issues. I will definitely need a bit of time to play around with it now and check what possibilities does this approach open. 

 

You must be logged in to post in the forum