asp.net – 在单独的配置文件中移出web.config
发布时间:2020-12-16 06:26:27 所属栏目:asp.Net 来源:网络整理
导读:我们的web.config中有很多(超过100个)重定向 configuration system.webServer httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found" add wildcard="/a" destination="/a/dfdf/default.htm" / add wildcard="/sad" destination="
我们的web.config中有很多(超过100个)重定向
<configuration> <system.webServer> <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found"> <add wildcard="/a" destination="/a/dfdf/default.htm" /> <add wildcard="/sad" destination="/aasd/dfdf/defsadault.htm" /> <add wildcard="/asdsaa" destination="/aasdas/dfasddf/default.htm" /> <add wildcard="/aasdsa" destination="/asdsaa/dfdf/defsdault.htm" /> <add wildcard="/aasd" destination="/adsa/dfdf/default.htm" /> ..... more than 100 </httpRedirect> </system.webServer> </configuration> 我们是否可以在单独的web.config或任何其他最佳解决方案中管理此部分? 解决方法
您可以将一些配置元素移动到自己的配置文件中,以减少web.config中的混乱.
<configuration> <system.webServer> <httpRedirect configSource="httpRedirects.config" /> </system.webServer> </configuration> 这是通过添加如上所示的configSource属性来实现的. 在你的单独httpRedirects.config中 <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found"> <add wildcard="/a" destination="/a/dfdf/default.htm" /> <add wildcard="/sad" destination="/aasd/dfdf/defsadault.htm" /> <add wildcard="/asdsaa" destination="/aasdas/dfasddf/default.htm" /> <add wildcard="/aasdsa" destination="/asdsaa/dfdf/defsdault.htm" /> <add wildcard="/aasd" destination="/adsa/dfdf/default.htm" /> </httpRedirect> 注意我只尝试过其他配置元素. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如何避免UpdatePanel在AutoPostBack上滚动?
- asp.net-mvc-3 – asp.net MVC Web API VS asp.net MVC 4和
- asp.net – 自动修复与’ASPStateTempSessions’相关的temp
- 集成ASP.NET身份的最佳做法 – 它们是否存在?
- .net – 在Request.Form中搜索控件/解析NameValueCollectio
- asp.net – .NET – 如何为大CSS文件构建主题
- asp.net-mvc – Fluent验证与默认的.NET数据注释相比有什么
- ASP.NET核心:如何获取远程IP地址?
- asp.net-mvc – 为什么Add View List Scaffolding向导不使用
- asp.net – 如何在MVC 3中设置图表系列颜色?
推荐文章
站长推荐
- asp.net – 在telerik网格的列中使用控件
- asp.net-mvc-3 – 有没有办法使用字符串键访问.N
- asp.net – 在Windows 7笔记本电脑中找不到IIS_I
- asp.net – 使用哪一个?数据库中的EAV或Blob?
- asp.net – 从域到www.domain的全局301重定向
- asp.net – 隐藏表单值
- asp.net – System.Web.HttpException:请求超时
- asp.net – 如何从Date对象减去一个月?
- asp.net-mvc-4 – ASP.NET MVC 4.0 RC和Newsoft.
- asp.net-mvc – ASP MVC友好的URL和相对路径图像
热点阅读