身份登录C#窗体 [英] Identity Login in C# windows forms

查看:67
本文介绍了身份登录C#窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个身份用户的SQL数据库,我使用我的Asp.Net Core 2.0 MVC应用程序正常工作。 我想使用同一个数据库在我的C#Winforms应用程序上登录用户。 我看到其他用户已经能够使用以下
对用户进行身份验证:

I have a SQL database of Identity users that I have working fine with my Asp.Net Core 2.0 MVC app.  I want to use this same database for logging in users on my C# Winforms app.  I see that other users have been able to authenticate a user using the following:

            var context = new IdentityConnectionDbContext();

            var userManager = new UserManager<IdentityUser>(new UserStore<IdentityUser>(context));

            var user = userManager.Find(username, password);
            
            if (user != null)
            {
                return true;
            }

            return false;




何时我尝试这样做,我总是为用户取回null。 我传递的相同凭据在我的Core 2.0应用程序上工作正常。

When I try to do this I always get back null for the user.  The same credentials that I am passing in work fine on my Core 2.0 app.

此代码找到我的用户:

var user = userManager.FindByEmail(user);


UserName和Email对于两者都是相同的值。

The UserName and Email is the same value for both.

感谢您的帮助。

推荐答案

您好,

我在这里找到了链接也许你可以参考:

Here I found a link maybe you can refer to:

ASP.NET身份登录

问候,

Kyle


这篇关于身份登录C#窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆