Reputation: 75
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"/>
Upvotes: 1
Views: 118
Reputation: 67918
You'll need to ignore that route, so in the RegisterRoutes
method, add this line:
routes.IgnoreRoute("Stackoverflow");
Upvotes: 2