在 Asp.Net 中通过 https 加载 UserControl
我正在创建一个 Asp.Net 应用程序,我需要通过 https 加载 UserControl。因此,在我的页面中,我使用以下代码加载它:
...
<%@ Register src="../../pages/controls/bar.ascx" tagname="bar" tagprefix="uc1" %>
<html>
<body>
...
<uc1:bar ID="bar1" runat="server" />
...
</body>
</html>
这里 UserControl 是通过 http 加载的。那么我应该怎么做才能从相同的位置但通过 https 协议加载它(证书已配置)?
谢谢
i'm creating an Asp.Net application and i need to load an UserControl via https. So, in my page i'm loading it with the following code:
...
<%@ Register src="../../pages/controls/bar.ascx" tagname="bar" tagprefix="uc1" %>
<html>
<body>
...
<uc1:bar ID="bar1" runat="server" />
...
</body>
</html>
Here the UserControl is correctyle loaded via http. So what should i do to load it from the same position but via the https protocol (the certificate is already configured)?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的主站点是 HTTP 并且您想要加载 HTTPS 控件,则需要在 src 行中输入绝对 URL 而不是相对 URL。
然而,我想指出的是,混合 HTTPS 和 HTTP 内容通常是不受欢迎的(想想当在 HTTPS 站点的 HTTP 连接上提供 images/js/css 时浏览器给您提供的弹出窗口。)。
为什么不使该页面或任何页面仅使用此控件 SSL?您甚至可以将所有这些页面分组到一个子目录中并仅使用 SSL。
If your main site is HTTP and you are wanting to load a HTTPS control, you will need to enter a absolute URL and not a relative URL in your src line.
However, I would like to point out that mixing HTTPS and HTTP content is generally frowned upon (think of the popups your browser gives you when images/js/css is served up on an HTTP connection for a HTTPS site.).
Why not make this page or any page using this control SSL only? You could even group all of these pages into one sub directory and make that SSL only.