asp.net网站如何支持https(ssl)?

时间:2013-12-24 03:34:16

标签: c# asp.net ssl https

我使用asp.net创建了一个网站,它已经工作并维护了3年。现在,客户要求我支持https以使客户成为可能。请求和个人信息在互联网上安全。这不是一个庞大的网站,只有用户登录和在线产品预订。

要求是:

  

1。如果用户未登录,http不含ssl,一旦用户登录,则启用https。

     

2。用户退出,返回http。

目前,我们支付了RapidSSL证书并等待代理商的回复。我不确定Web应用程序还需要进行多少更改? asp.net 2.0如何支持ssl满足这些要求。

2 个答案:

答案 0 :(得分:0)

首先需要在服务器上安装证书,这将是您的Web应用程序所在的位置。

在我的情况下,我将使用安全开关 - > https://code.google.com/p/securityswitch/

您可以选择保护网络配置中的某个文件夹,也可以选择要忽略的文件夹。

 <securitySwitch mode="Off" xmlns="http://SecuritySwitch-v4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SecuritySwitch-v4.xsd">
<paths>
  <!-- You should only need one of these paths based on where your login/logon page/view is accessed from. -->
  <add path="~/Account/" />
  <add path="~/Application/" />  
  <add path="~/Images/" security="Ignore" />
  <add path="~/Scripts/" security="Ignore" />
</paths>

答案 1 :(得分:0)

您可能还需要要求用户的浏览器使用https进行连接,因为有些人不会自动进行连接。我不确定上面的工具是否会自动执行此操作,但您可以使用web.config执行此操作..

<system.webServer>
<rewrite>
        <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
相关问题