• 大小: 18.45MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-26
  • 语言: Html/CSS
  • 标签: JWT  

资源简介

请参考博客:http://www.cnblogs.com/chenwolong/p/Token.html

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;

namespace TestForToken
{
    // 注意: 有关启用 IIS6 或 IIS7 经典模式的说明,
    // 请访问 http://go.microsoft.com/?linkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

        /// 
        /// 登录验证、s授权
        /// 

        /// 
        /// 
        protected void Application_AuthenticateRequest(object sender EventArgs e)
        {
            string cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];
            FormsAuthenticationTicket authTicket = null;
            try
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            }
            catch (Exception ex)
            {
                return;
            }
            string[] roles = authTicket.UserData.Split(‘‘);
            FormsIdentity id = new FormsIdentity(authTicket);
            GenericPrincipal principal = new GenericPrincipal(id roles);
            Context.User = principal;//存到HttpContext.User中     
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        209  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\Content\App.config.transform

     文件        209  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\Content\Web.config.transform

     文件    1416507  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\Entityframework.5.0.0.nupkg

     文件    1118296  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net40\Entityframework.dll

     文件    1142742  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net40\Entityframework.xml

     文件      71256  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net40\zh-Hans\Entityframework.resources.dll

     文件     478229  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net40\zh-Hans\Entityframework.xml

     文件    1116760  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net45\Entityframework.dll

     文件    1138045  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net45\Entityframework.xml

     文件      71256  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net45\zh-Hans\Entityframework.resources.dll

     文件     478229  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\lib\net45\zh-Hans\Entityframework.xml

     文件        969  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\about_Entityframework.help.txt

     文件     134744  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Entityframework.PowerShell.dll

     文件      15960  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Entityframework.PowerShell.Utility.dll

     文件      24418  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Entityframework.PS3.psd1

     文件      24428  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Entityframework.psd1

     文件      30378  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Entityframework.psm1

     文件      10275  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\init.ps1

     文件      10424  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\install.ps1

     文件     130136  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\migrate.exe

     文件        500  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Redirect.config

     文件        752  2017-11-01 17:16  TestForToken\packages\Entityframework.5.0.0\tools\Redirect.VS11.config

     文件     143618  2017-11-01 17:16  TestForToken\packages\Entityframework.zh-Hans.5.0.0\Entityframework.zh-Hans.5.0.0.nupkg

     文件      71256  2017-11-01 17:16  TestForToken\packages\Entityframework.zh-Hans.5.0.0\lib\net40\zh-Hans\Entityframework.resources.dll

     文件     478229  2017-11-01 17:16  TestForToken\packages\Entityframework.zh-Hans.5.0.0\lib\net40\zh-Hans\Entityframework.xml

     文件      71256  2017-11-01 17:16  TestForToken\packages\Entityframework.zh-Hans.5.0.0\lib\net45\zh-Hans\Entityframework.resources.dll

     文件     478229  2017-11-01 17:16  TestForToken\packages\Entityframework.zh-Hans.5.0.0\lib\net45\zh-Hans\Entityframework.xml

     文件     227237  2017-11-01 17:16  TestForToken\packages\jQuery.1.7.1.1\Content\scripts\jquery-1.7.1-vsdoc.js

     文件     257476  2017-11-01 17:16  TestForToken\packages\jQuery.1.7.1.1\Content\scripts\jquery-1.7.1.js

     文件      93871  2017-11-01 17:16  TestForToken\packages\jQuery.1.7.1.1\Content\scripts\jquery-1.7.1.min.js

............此处省略542个文件信息

评论

共有 条评论