小编Pab*_*ash的帖子

C#中的AES加密和CryptoJS中的解密

我想在C#中进行AES加密,在CryptoJS中进行解密.

encryption aes cryptojs

4
推荐指数
1
解决办法
8046
查看次数

由于其保护级别,Microsoft.Owin.Security.AuthenticationManager'无法访问

我正在尝试实现ASP.NET Identity 2.0.我在VS 2012中创建了一个MVC4项目,并使用Nu Get命令安装了ASP.NET Identity 2.0软件包.我收到编译错误消息"Microsoft.Owin.Security.AuthenticationManager"由于其保护级别而无法访问,具有以下代码.

获取编译错误,因为AuthenticationManager是程序集EntityFramework.dll中的内部类.因此,我可以从AuthenticationManager派生一个类并调用公共方法SignIn()和SignOut().

在同一个程序集中有一个AuthenticationManagerExtensions类.我怎样才能将它用于SignIn和SignOut?

using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System.Threading.Tasks;
using Microsoft.Owin.Security;

    private async Task SignInAsync(ApplicationUser user, bool isPersistent)
    {
        AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);

        var identity = await UserManager.CreateIdentityAsync(
           user, DefaultAuthenticationTypes.ApplicationCookie);

        AuthenticationManager.SignIn(
           new AuthenticationProperties()
           {
               IsPersistent = isPersistent
           }, identity);
    }
Run Code Online (Sandbox Code Playgroud)

asp.net-identity

3
推荐指数
1
解决办法
5251
查看次数

标签 统计

aes ×1

asp.net-identity ×1

cryptojs ×1

encryption ×1