public ActionResult ForgetPassword(string EmailId) { try { string RandomPassword = GenerateRandomPassword.GenerateRandomCode(10); if (!LoginData.CheckEmailIdExist(EmailId, RandomPassword)) { ViewBag.message = "If the entered email id exists then new password has been sent to the entered email id."; return(View()); } string imagepath = UrlExtensions.LinkToRegistrationProcess("Content/img/logo_email.png"); bool isResult = SendMail.Sendchangepassword(EmailId, RandomPassword, string.Empty, Server.MapPath("~/MailTemplate"), imagepath); if (isResult) { ViewBag.message = "If the entered email id exists then new password has been sent to the entered email id."; } else { ViewBag.message = "Error occurred. Please, try again later."; } return(View()); } catch (Exception Ex) { ViewBag.message = Ex.Message; return(View()); } }