Asp.net+Vue+EmelentUI的实现(二)登录验证

本文详细介绍了使用Asp.net构建登录验证的过程,包括web.config配置、登录roles设置、页面及控制器验证,确保用户在登录后才能访问特定资源。
摘要由CSDN通过智能技术生成

在《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
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值