简体   繁体   English

如何自动登录IIS网站?

[英]How to Auto Login IIS website?

I have a website which users upload large files on it. 我有一个网站,用户可以在上面上传大文件。 In order to keep site responsive, I have separated upload part from the main part. 为了保持网站的响应速度,我将上传部分与主要部分分开。 Now there are two websites with two different app pools but both app pools are using the same user identity to run. 现在,有两个拥有两个不同应用程序池的网站,但是两个应用程序池都使用相同的用户身份运行。 The problem is now users must first login into the main site and in order to upload they have to login again! 现在的问题是,用户必须先登录主站点,然后才能上载,然后必须再次登录! How can I auto login a user which has already logged in the main site? 如何自动登录已经登录主站点的用户?

I'm using ASP.NET MVC but with Old ASP.NET membership on Windows Server 2016 (IIS 10) and here is my web.config: 我正在使用ASP.NET MVC,但在Windows Server 2016(IIS 10)上具有旧的ASP.NET成员身份,这是我的web.config:

<membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="NewsDb" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="3" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>

to share form authenticate in different websites, you need to make sure your websites are under same main domain, otherwise you will need to implement a lot of codes 要在不同的网站上共享表单身份验证,您需要确保您的网站位于同一主域下,否则您将需要实施大量代码

check your <authentication> node in your web.config 检查您的web.config中的<authentication>节点

for your main website with login page 您的带有登录页面的主要网站

<authentication mode="Forms">
<forms loginUrl="login.aspx" name="{your_auth_cookie_name}" timeout="120" slidingExpiration="true" domain=".yourdomain.com"  enableCrossAppRedirects="true"/>
</authentication>

for your upload site 用于您的上传网站

<authentication mode="Forms">
<forms loginUrl="https://mainsite/login.aspx" name="{your_auth_cookie_name}" timeout="120" slidingExpiration="true" domain=".yourdomain.com"  enableCrossAppRedirects="true"/>
</authentication>

if your deployed your websites on different server, you may need unify the machine key to make sure the decryption of auth cookie is correct 如果您将网站部署在其他服务器上,则可能需要统一计算机密钥,以确保身份验证Cookie的解密正确

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM