Pregunta

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"/>
¿Fue útil?

Solución

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

routes.IgnoreRoute("Stackoverflow");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top