質問

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"/>
役に立ちましたか?

解決

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

routes.IgnoreRoute("Stackoverflow");
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top