Eventhandler in MVC4

UserStackk

I am a newby in MVC4.

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    //GlobalConfiguration.Configure(WebApiConfig.Register);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

I want to call a handler when I write .../Stackoverflow but always Stackoverflow controller works. How can I stop to call Stackoverflow controller? I only want to call handler.

I add below statement to the web.config.

  <add name="MyHandler" verb="*" path="/Stackoverflow " type="Library.MyHander"/>
Mike Perrenoud

You'll need to ignore that route, so in the RegisterRoutes method, add this line:

routes.IgnoreRoute("Stackoverflow");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related