网站的根使用表单身份验证将用户注销

Root of website signs user out using forms authentication

我发现当用户登录我的站点时,例如http://www.website.com,他们可以正常登录,但是当他们通过删除 www 来切换站点时,即 http://website.com 他们实际上是不同的用户,我该如何阻止呢?有什么建议么。我希望该站点指向完整路径 http://www.website.com,google chrome 倾向于去掉 www - Internet Explorer 没问题(一次)。

我通过更改 web.config 文件中的以下内容解决了这个问题:

  <configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect to WWW" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^website.com$" />
          </conditions>
          <action type="Redirect" url="http://www.website.com/{R:0}"
                  redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer> 
</configuration>