如何对 ASP.NET 4 的某些文件夹禁用 ssl?

发布于 2024-10-07 06:49:45 字数 54 浏览 0 评论 0原文

我想在 ASP.Net 4 Web 应用程序的某些文件夹中禁用 SSL。 有办法做到这一点吗?

I want to disable SSL in some folders of a ASP.Net 4 web application.
Is there a way to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平定天下 2024-10-14 06:49:45

我的脑海中并没有出现任何“ASP.Net 4”的方法来做到这一点。您必须手动实现此功能。

如果不知道您的网络应用程序的具体情况,就很难提供示例。
例如,如果您使用的是 asp.net mvc,您可以让与应用程序中的“文件夹”相关的控制器检查 SSL(例如,通过检查原始请求的端口号)并将其重定向到等效的站点的非 SSL 版本中的操作。但是,您将丢失任何会话上下文(只有在使用会话时才会出现问题)。

使用此行为配置 ASP.Net Web 表单可能会有点棘手。

There's no 'ASP.Net 4' way of doing this that springs to mind. You would have to implement this functionality by hand.

Without knowing what the specifics of your web app are it is hard to offer examples.
For instance, if you are using asp.net mvc, you could have the controller that pertains to a 'folder' within your app check for SSL (by examining the port number of the originating request for instance) and having it redirect to the equivalent action in a non-SSL version of the site. You would, however, lose any session context (only a concern if you are using session).

ASP.Net webforms would probably be a little trickier to configure with this behaviour.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文