本文介绍了ASP.NET MVC - 重新发送一封确认邮件,WebSecurity?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图使用WebSecurity如果我的用户丢失,需要重新发送,或者改变他们的电子邮件,他们似乎没有任何办法通过WebSecurity类重置您的确认凭证。

Trying to use the WebSecurity and if my user loses, needs to resend, or otherwise changes their email, their does not seem to be any way to reset your confirmation token via the WebSecurity classes.

我如何重置WebSecurity确认令牌Asp.NET MVC?

How do I reset the confirmation token for WebSecurity in Asp.NET MVC?

推荐答案

似乎没有要在WebSecurity类型的支持。我被迫直接查询数据库。因为我是用我的EF code看起来像以下内容:

There doesn't seem to be support for this in the WebSecurity type. I was forced to query the database directly. Since I was using EF my code looked like the following:

    public string GetConfirmationToken(string email)
    {
        using (var db = new DbContext())
        {
            var tsqlQuery = string.Format("SELECT [ConfirmationToken] FROM [webpages_Membership] WHERE [UserId] IN (SELECT [UserId] FROM [UserProfile] WHERE [Email] LIKE '{0}')", email);
            return db.Database.SqlQuery<string>(tsqlQuery).First();
        }
    }

这篇关于ASP.NET MVC - 重新发送一封确认邮件,WebSecurity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 22:50