开发者

API for IIS7 Rewrite Section

开发者 https://www.devze.com 2023-02-02 00:23 出处:网络
Is there an API that I just can\'t find under system.webserver for the rewrite sec开发者_JAVA技巧tion, or perhaps under Microsoft.Web.Administration with a strongly typed Rewrite class? I\'d rather no

Is there an API that I just can't find under system.webserver for the rewrite sec开发者_JAVA技巧tion, or perhaps under Microsoft.Web.Administration with a strongly typed Rewrite class? I'd rather not have to write that class by hand, since I assume it's already there somewhere for use by IIS.


Because the URL Rewrite module is an IIS extension there aren't "strongly typed" classes built into the Microsoft.Web.Administration namespace to do this. i.e. there isn't a class called Microsoft.Web.Administration.UrlRewrite.

However, you can work with the built-in ConfigurationSection, ConfigurationElementCollection and ConfigurationElement classes to manipulate the <rewrite> section of your web.config.

One of the IIS Program Managers has a blog entry about programmatically configuring the URL Rewrite Module:

Scripting URL rewrite module configuration

That should get you started.

0

精彩评论

暂无评论...
验证码 换一张
取 消