如何防止URL中没有协议的站点打开,例如(https://) [英] How to prevent site open without protocol in url eg(https://)

查看:203
本文介绍了如何防止URL中没有协议的站点打开,例如(https://)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站不应该没有协议打开



我正在使用https,但我的网站没有使用这个,如何防止这种情况。



我尝试了什么:



i对此不知道,我看到了这个链接http:/ /stackoverflow.com/questions/21281995/prevent-url-without-protocol-to-become-relative-url但我什么都不知道。

my site should not open without protocol

am using https, but my site working without using this , how to prevent this.

What I have tried:

i have no idea on this , i saw this link http://stackoverflow.com/questions/21281995/prevent-url-without-protocol-to-become-relative-url but i dont have any idea.

推荐答案

你可以要么删除IIS中的http绑定,所以它根本不响应http请求(在iis中使用google http和https绑定来解释你是如何做到的),或者你可以检测到它是使用http并重定向到https而不是从URL重写器模块或您自己的代码中执行此操作的几种方法。谷歌asp.net重定向http到https,你会发现很多关于如何做到这一点的文章。这是一个非常常见的要求,因此有很多信息。
You can either remove the http binding in IIS so it simply doesn't respond to http requests (google http and https bindings in iis for explanations of how you do that), or you can detect it is using http and redirect to https instead and there are a few ways of doing that, from the url rewriter module or in your own code. Google "asp.net redirect http to https" and you'll find lots of articles on how to do this. It's a very common requirement so there is a lot of info out there.


这篇关于如何防止URL中没有协议的站点打开,例如(https://)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆