What is routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”)

前端 未结 5 1859
一整个雨季
一整个雨季 2020-11-29 00:17

What is routes.IgnoreRoute(\"{resource}.axd/{*pathInfo}\")

I cannot find any .axd file in my project, can I remove this route rule?

5条回答
  •  -上瘾入骨i
    2020-11-29 01:09

    The route with the pattern {resource}.axd/{*pathInfo} is included to prevent requests for the Web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller.

    Read link: http://msdn.microsoft.com/en-us/library/cc668201%28v=vs.100%29.aspx

    You can also specify that routing should not handle certain URL requests. You prevent routing from handling certain requests by defining a route and specifying that the StopRoutingHandler class should be used to handle that pattern. When a request is handled by a StopRoutingHandler object, the StopRoutingHandler object blocks any additional processing of the request as a route. Instead, the request is processed as an ASP.NET page, Web service, or other ASP.NET endpoint. You can use the RouteCollection.Ignore method (or RouteCollectionExtensions.IgnoreRoute for MVC applications) to create routes that use the StopRoutingHandler class.

提交回复
热议问题