ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Implement Forgot Password using AngularJS and Entity Framework in ASP.Net MVC<p>Hi <a class="username" rel="mahesh213">mahesh213</a>,</p> <p>Using the below article i have created the example.</p> <h1 class="header"><a title="Implement Forgot Password (Password Recovery) and send password in Email in ASP.Net'a" href="https://www.aspsnippets.com/Articles/Implement-Forgot-Password-Password-Recovery-and-send-password-in-Email-in-ASPNet.aspx">Implement Forgot Password (Password Recovery) and send password in Email in ASP.Net</a></h1> <p>Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Namespaces</span></strong></p> <pre class="brush: csharp">using System.Net; using System.Net.Mail;</pre> <p><strong><u>Controller</u></strong></p> <pre class="brush: csharp">public class HomeController : Controller { // GET: /Home/ public ActionResult Index() { return View(); } public JsonResult SendEmail(string email) { string message = &#34;This email address does not match our records.&#34;; UserEntities entities = new UserEntities(); User user = entities.Users.Where(x =&gt; x.Email == email).FirstOrDefault(); if (user != null) { string username = user.Username; string password = user.Password; if (!string.IsNullOrEmpty(password)) { MailMessage mm = new MailMessage(&#34;sender@gmail.com&#34;, email); mm.Subject = &#34;Password Recovery&#34;; mm.Body = string.Format(&#34;Hi {0},&lt;br /&gt;&lt;br /&gt;Your password is {1}.&lt;br /&gt;&lt;br /&gt;Thank You.&#34;, username, password); mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = &#34;smtp.gmail.com&#34;; smtp.EnableSsl = true; NetworkCredential NetworkCred = new NetworkCredential(); NetworkCred.UserName = &#34;sender@gmail.com&#34;; NetworkCred.Password = &#34;&lt;Password&gt;&#34;; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 587; smtp.Send(mm); message = &#34;Password has been sent to your email address.&#34;; } } return Json(message, JsonRequestBehavior.AllowGet); } }</pre> <p><strong><span style="text-decoration: underline;">View</span></strong></p> <pre class="brush: html">&lt;html&gt; &lt;head&gt; &lt;title&gt;Index&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, []); app.controller(&#34;MyController&#34;, function ($scope, $http, $window) { $scope.SendEmail = function () { $http.get(&#34;/Home/SendEmail/&#34;, { params: { email: $scope.Email} }) .then(function (response) { $scope.Message = response.data; if (response.data == &#39;This email address does not match our records.&#39;) { $scope.Color = &#34;Red&#34;; } else if (response.data == &#39;Password has been sent to your email address.&#39;) { $scope.Color = &#34;Green&#34;; } $scope.Email = &#34;&#34;; }).then(function (response) { $scope.Message = response.responseText; }); } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; &lt;input type=&#34;text&#34; name=&#34;email&#34; ng-model=&#34;Email&#34; /&gt; &lt;input type=&#34;button&#34; name=&#34;name&#34; value=&#34;Send&#34; ng-click=&#34;SendEmail()&#34; /&gt; &lt;br /&gt; &lt;span ng-style=&#34;{color:Color}&#34; ng-bind=&#34;Message&#34;&gt;&lt;/span&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/HI2RnFU.gif" alt="" width="334" height="123" /></span></strong></p>https://www.aspforums.net:443/Threads/199392/Implement-Forgot-Password-using-AngularJS-and-Entity-Framework-in-ASPNet-MVC/https://www.aspforums.net:443/Threads/199392/Implement-Forgot-Password-using-AngularJS-and-Entity-Framework-in-ASPNet-MVC/Mon, 01 Apr 2019 03:49:19 GMT