I'm using IIS7 UrlRewrite module.
I set up my rules in the web.config <system.webServer><rewrite>
section.
I want to know if there's a way to define the rules in one external xml file instead of in web.config file.
Thanks.
相关问题
- Improve converting string to readable urls
- IIS virtual directory from web.config
- .NET using wrong 2.0 machine.config instead of 4.0
- There Was No Endpoint Listening at http // That Co
- Can we override parent website's web.config?
相关文章
- XCopy or MOVE do not work when a WCF Service runs
- The 'DbProviderFactories' section can only
- Using relative path in assemblyBindig/linkedConfig
- ASP.NET code to detect whether IIS “Windows Authen
- Installing Web Deploy on IIS 7+ with Shared Config
- IIS7: Possible causes of 'Unrecognized configu
- Should I set ASP.NET application pool to auto-recy
- Publish is not transforming web.config?
Yes, you can use the
configSource
attribute to point to an external file like you can with other web.config sections. In the web.config:And in the rules config file:
You can still even use the IIS manager to edit rules and it'll just work. One minor caveat with this approach: when you make a change and save an external file like this, it will not recycle the application like making a change to the web.config will. So if you're editing a rule and want to see it take effect, you need to manually poke the web.config by making an edit and saving it.
Another reference: Moving IIS7 url rewrite section out of the web.config file
You can use the sample URL Rewrite providers that include one for storing those in a separate file, see: http://www.iis.net/learn/extensions/url-rewrite-module/using-custom-rewrite-providers-with-url-rewrite-module