ASP.NET MVC - Routing - an action with file extension

后端 未结 3 1432
野的像风
野的像风 2020-11-30 07:17

is there a way to achieve calling URL http://mywebsite/myarea/mycontroller/myaction.xml This would basically \"fake\" requesting a file but the result would be

3条回答
  •  半阙折子戏
    2020-11-30 07:54

    You need to map requests for your XML files to TransferRequestHandler in web.config. Otherwise IIS will handle the request.

    Jon Galloway explains how to do this here.

    In summary, you add this element to location/system.webServer/handlers in your web.config:

    
    

提交回复
热议问题