简体   繁体   English

使IIS 7.5将* .xml请求传递给asp.net

[英]Make IIS 7.5 pass *.xml requests to asp.net

How do I configure IIS 7.5 to forward all *.xml file requests to asp.net engines so i can handle them in Global.asax and rewrite the path to a *.aspx file? 如何配置IIS 7.5以将所有* .xml文件请求转发到asp.net引擎,以便我可以在Global.asax中处理它们并重写* .aspx文件的路径? Now IIS is expecting to find them directly on disk. 现在IIS希望直接在磁盘上找到它们。 I will use this do dynamically generate my sitemap.xml 我将使用这个动态生成我的sitemap.xml

You can force static files to go through the ASP.NET pipeline by editing your web.config: 您可以通过编辑web.config强制静态文件通过ASP.NET管道:

<system.webServer>
    <handlers>
      <add name="XMLHandler" type="System.Web.StaticFileHandler" path="*.xml" verb="GET"  />
    </handlers>
</system.webServer>
  1. HTTP Handlers and HTTP Modules Overview HTTP处理程序和HTTP模块概述
  2. How to: Register HTTP Handlers 如何:注册HTTP处理程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM