title: Where to find C# sample code to implement password recovery in ASP .NET MVC2
body: <p>How to implement password reset in MVC2 application?</p>
  
  <p>Passwords are hashed using ASP .NET membership provider.  Password recovery question is not used. Standard ASP .NET MVC2 project template with standard AccountController class is used.</p>
  
  <p>If user forgots password, email with temporary link or with new password should sent to user e-mail address .</p>
  
  <p>Where to find code to implement this in MVC 2 C# ?</p>
  
  <p>stack overflow contains two answers which discuss methods about implementing this. There is not sample code. 
  I googled for "asp .net mvc password reset c# sample code download" but havent found sample code for this.</p>
  
  <p>I'm new to MVC. Where to find sample code for password recovery? This is missing from VS2010 generated project template.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I tried this code in Mono 2.10 but got exception:</p>
  
  <p>CspParameters not supported by Mono</p>
  
  <p>at line</p>
  
  <pre><code>        des.Key = pdb.CryptDeriveKey("RC2", "MD5", 128, new byte[8]);
  </code></pre>
  
  <p>How to run it in Mono ?</p>
  
  <p>Stack Trace: </p>
  
  <pre><code>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) &lt;IL 0x00055, 0x000f3&gt;
  at store2.Helpers.AccountHelper.GetTokenForValidation (string) &lt;IL 0x00033, 0x00089&gt;
  at MvcMusicStore.Controllers.AccountController.PasswordReminder (MvcMusicStore.Models.PasswordReminderModel) &lt;IL 0x001ac, 0x00495&gt;
  at (wrapper dynamic-method) System.Runtime.CompilerServices.ExecutionScope.lambda_method (System.Runtime.CompilerServices.ExecutionScope,System.Web.Mvc.ControllerBase,object[]) &lt;IL 0x00020, 0x0005b&gt;
  at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase,object[]) &lt;IL 0x00008, 0x0001b&gt;
  at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext,System.Collections.Generic.IDictionary`2&lt;string, object&gt;) &lt;IL 0x00072, 0x00103&gt;
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor,System.Collections.Generic.IDictionary`2&lt;string, object&gt;) &lt;IL 0x00003, 0x00019&gt;
  at System.Web.Mvc.ControllerActionInvoker/&lt;&gt;c__DisplayClassd.&lt;InvokeActionMethodWithFilters&gt;b__a () &lt;IL 0x0002d, 0x00068&gt;
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter (System.Web.Mvc.IActionFilter,System.Web.Mvc.ActionExecutingContext,System.Func`1&lt;System.Web.Mvc.ActionExecutedContext&gt;) &lt;IL 0x00031, 0x000b6&gt;
  
  
  --------------------------------------------------------------------------------
  Version information: Mono Runtime Version: 2.10.2 (tarball Mon Apr 18 18:57:39 UTC 2011); ASP.NET Version: 2.0.50727.1433
  </code></pre>