ASP.NET httpRedirect:重定向所有页面,除了一个
发布时间:2020-05-23 15:38:38 所属栏目:asp.Net 来源:互联网
导读:我使用这个代码在web.config在我的网站的一个文件夹中的所有页面重定向到根,因为我想永久关闭这一节。 ?xml version=1.0 encoding=utf-8?configuration location system.webServer httpRedirect enabled=true destination=http://w
|
我使用这个代码在web.config在我的网站的一个文件夹中的所有页面重定向到根,因为我想永久关闭这一节。 <?xml version="1.0" encoding="utf-8"?>
<configuration>
<location>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.example.com/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
但是我需要对这个规则做一个例外:我不希望我的页面“default.aspx”被重定向。我怎样才能做到这一点? 解决方法您可以按以下方式添加通配符,仅重定向某些文件:<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*.php" destination="/default.htm" />
</httpRedirect>
</system.webServer>
</configuration>
但是我不知道你是否可以否定这一点,所以它忽略了某个文件。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.NET Web部署项目是否存活?
- 使用Gzip在ASP.NET / IIS7中输出乱码错误页面
- IIS和ASP.Net Web开发服务器之间的行为差异?
- asp.net-mvc-3 – ASP.NET MVC 3,RavenDB和Autofac Issue P
- 实体框架 – 如何添加外部参考ASP.Net MVC 5身份?
- asp.net-mvc – 不一致的可访问性:DbContext中的属性类型
- asp.net-mvc – ASP.NET MVC检查用户是否属于[x]组
- asp.net – jQuery弹出窗口返回父级的值
- asp.net – Stripe Webhook事件续订订阅
- asp.net-mvc – 如何使用EditorForModel()来装饰我的ASP.NE
推荐文章
站长推荐
- asp.net – 在另一个控件之前插入控件
- asp.net-mvc – 使用Asp.net MVC 4中的OutputCac
- asp.net-mvc – 接受逗号和点作为小数分隔符[重复
- asp.net – 如何在抛出请求验证异常时显示自定义
- ASP.NET和.NET框架版本之间的区别
- asp.net-mvc – redirectToAction()和View()之间
- 如何配置ASP.NET OutputCache与http vs https不同
- asp.net-mvc – 未设置localhost cookie
- 使用ASP.NET MVC进行Windows身份验证
- asp.net – 找不到元素’elmah’的架构信息
热点阅读
