如何在MVC2应用程序中实现密码重置?
使用ASP .NET成员资格提供程序对密码进行哈希处理.不使用密码恢复问题.使用具有标准AccountController类的标准ASP .NET MVC2项目模板.
如果用户忘记了密码,则应将带有临时链接或新密码的电子邮件发送到用户的电子邮件地址.
在MVC 2 C#中哪里可以找到实现它的代码?
堆栈溢出包含两个答案,讨论实现它的方法.没有示例代码.我搜索了"asp .net mvc密码重置c#示例代码下载",但还没有找到示例代码.
我是MVC的新手.在哪里可以找到密码恢复的示例代码?这是VS2010生成的项目模板中缺少的.
更新
我在Mono 2.10中尝试了这个代码,但是有异常:
Mono不支持CspParameters
在线
des.Key = pdb.CryptDeriveKey("RC2", "MD5", 128, new byte[8]);
Run Code Online (Sandbox Code Playgroud)
如何在Mono中运行它?
堆栈跟踪:
System.NotSupportedException: CspParameters not supported by Mono
at System.Security.Cryptography.PasswordDeriveBytes.CryptDeriveKey (string,string,int,byte[]) [0x0001b] in /usr/src/redhat/BUILD/mono-2.10.2/mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs:197
at store2.Helpers.Password.EncodeMessageWithPassword (string,string) <IL 0x00055, 0x000f3>
at store2.Helpers.AccountHelper.GetTokenForValidation (string) <IL 0x00033, 0x00089>
at MvcMusicStore.Controllers.AccountController.PasswordReminder (MvcMusicStore.Models.PasswordReminderModel) <IL 0x001ac, 0x00495>
at (wrapper dynamic-method) System.Runtime.CompilerServices.ExecutionScope.lambda_method (System.Runtime.CompilerServices.ExecutionScope,System.Web.Mvc.ControllerBase,object[]) <IL 0x00020, 0x0005b>
at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase,object[]) <IL 0x00008, 0x0001b>
at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext,System.Collections.Generic.IDictionary`2<string, object>) <IL 0x00072, 0x00103>
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod …Run Code Online (Sandbox Code Playgroud) 我正在构建一个ASP.NET MVC 2站点,我希望用户在注册后验证他们的电子邮件地址.
我想向该地址发送一封电子邮件,其中包含用户可以单击以验证其电子邮件的链接,然后处理该链接的单击(当然,该链接将包含特定的ID).
当然,这很容易手动实现,但是ASP.NET中已经内置了具有这种功能的东西吗?