Understanding routing in Global.asax (asp.net-mvc)

后端 未结 4 2163
南旧
南旧 2021-02-08 11:18

In Global.asax what does the following signify?

 routes.IgnoreRoute(\"{resource}.axd/{*pathInfo}\");     
4条回答
  •  别跟我提以往
    2021-02-08 11:57

    An .axd file is a virtual file that is handled by an HTTP Handler. They are used for (amongst other things) delivering various resources to the webpage, such as automatically generated javascript for AJAX controls and the like.

    As these are virtual files, you do not want the routing engine to try to map these requests to controllers. You need them to be executed directly by ASP.NET.

    That is what the line achieves.

提交回复
热议问题