ASP.NET站点.将整个域从http重定向到https
发布时间:2020-12-16 07:18:39 所属栏目:asp.Net 来源:网络整理
导读:就像在标题中一样.如何重定向整个域,例如:http://testdomain.com.au/到https://testdomain.com.au/我可以在IIRF文件中执行此操作吗?如果是,这应该是什么样子?如何将IIRF文件绑定到站点? 解决方法 您可以通过IIS Rewrite模块执行此操作: http://www.iis
就像在标题中一样.如何重定向整个域,例如:http://testdomain.com.au/到https://testdomain.com.au/我可以在IIRF文件中执行此操作吗?如果是,这应该是什么样子?如何将IIRF文件绑定到站点?
解决方法
您可以通过IIS Rewrite模块执行此操作:
http://www.iis.net/downloads/microsoft/url-rewrite http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7 <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> 或者您可以通过Global.asax文件重定向: protected void Application_BeginRequest(Object sender,EventArgs e) { if ( !Request.IsSecureConnection) { string path = string.Format("https{0}",Request.Url.AbsoluteUri.Substring(4)); Response.Redirect(path); } } http://forums.asp.net/t/1340392.aspx (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 如何使用图像呈现动作链接?
- asp.net-mvc – ErrorAttribute vs OnException与Applicati
- asp.net-mvc – 使用ASP.NET MVC的基础认证
- EF数据库初始化策略及种子数据的添加
- 如何在asp.net(C#)中创建动态页面?
- asp.net-mvc-3 – 在渲染的部分视图中访问Viewbag数据
- asp.net-mvc – 我可以获取html.HiddenFor / Html.Hidden创
- 通过asp.net中的C#将参数传递给CRYSTAL REPORT
- asp.net-mvc-3 – 如何根据Screen vs Handheld切换_layout.
- asp.net-mvc – 嵌套的EditorFor / DisplayFor覆盖字段名称
推荐文章
站长推荐
- 也谈事件(Event)
- asp.net – 错误:“填充:SelectCommand.Connec
- asp.net – 如何以WPF格式捕获网页的按钮点击事件
- asp.net-mvc – 服务层内的成员资格提供者
- Asp Mvc3 webgrid通过ajax进行分页和过滤
- asp.net-mvc – ASP.NET MVC 4 – 使用子操作进行
- .net – 在生产环境中应该使用’Integrated Secu
- oracle wrapped 代码解密工具 unwraper
- 为什么使用ASP.NET OutputCache继续返回200 OK,而
- .NET发送电子邮件的最佳方法(System.Net.Mail有问
热点阅读