【问题标题】:Implement ASP.NET Identity without a database在没有数据库的情况下实现 ASP.NET Identity
【发布时间】:2015-02-20 10:09:08
【问题描述】:

我有一个需要用户登录的站点 (MVC5)。但是我无法控制用户数据库,而是有一个带有类似方法的 Web 服务。

public bool LogIn(string username, string password);

如果返回true,我需要登录用户,知道如何实现吗?

我读过这篇文章 http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity 但不知道如何创建自己的上下文,因为作者没有提供可下载的解决方案示例,所以卡在这部分。

public void ConfigureAuth(IAppBuilder app)
{
    app.CreatePerOwinContext(ExampleStorageContext.Create);
    app.CreatePerOwinContext(ApplicationUserManager.Create);
    ...

任何帮助将不胜感激,对英语不好表示抱歉。

【问题讨论】:

    标签: c# asp.net-mvc


    【解决方案1】:

    在这种情况下,您可以简单地使用Session 来保存用户状态。

    【讨论】:

    • 我不想使用 Session,因为我需要 ASP.Identity 功能。
    猜你喜欢
    • 1970-01-01
    • 2018-12-13
    • 2014-11-24
    • 2015-07-21
    • 1970-01-01
    • 1970-01-01
    • 2018-08-03
    • 2023-03-06
    • 2015-01-19
    相关资源
    最近更新 更多