在《Asp.net+Vue+EmelentUI的实现(一)框架搭建》一文中实现了简单的框架搭建,现在继续登录验证的实现。我们采用的是Asp.net来构建的,所以首选asp.net的验证机制。
1.web.config的配置
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" executionTimeout="500" maxRequestLength="40960000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
<customErrors mode="Off" />
<authentication mode="Forms">
<forms loginUrl="/Login/login.aspx" name=".ASPXAUTH" timeout="450" slidingExpiration="true" path="/" />
</authentication>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<location path="Pages">
<system.web>
<authorization>
<allow roles="AspNetVueElementUI" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="default.aspx">
<system.web>
<authorization>
<allow roles="AspNetVueElementUI" />
<deny users="*" />
</authorization>
</system.web>
</location>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyT