How to fix 'The name 'WebSecurity' does not exist in the current context'?
<p>I'm using asp.net c# mvc with Entity Framework to create a website. In there I want to create reset password part And I have the following code for the controller.</p>

<pre><code>[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult ResetPassword(ResetPasswordViewModel resetpasswordmodel)
{
    if (ModelState.IsValid)
    {
        //User user;
        MembershipUser member;
        using (TheFoodyContext db = new TheFoodyContext())
        {
            var foundemail = (from e in db.Users
                                 where e.email == resetpasswordmodel.Email
                                 select e.email).FirstOrDefault();

            if (foundemail != null)
            {
                member = Membership.GetUser(foundemail.ToString());
            }
            else
            {
                member = null;
            }
        }

        if (member != null)
        {
            //Generate password token that will be used in the email link to authenticate user
            var token = WebSecurity.GeneratePasswordResetToken(member.Email);
            // Generate the html link sent via email
            string resetLink = "&lt;a href='"
               + Url.Action("ResetPassword", "Account", new { rt = token }, "http")
               + "'&gt;Reset Password Link&lt;/a&gt;";
            // Email stuff
            string subject = "Reset your password for TheFoody.com";
            string body = "You link: " + resetLink;
            string from = "abcd123@gmail.com";
            string to = resetpasswordmodel.Email;

            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, to);
            message.Subject = subject;
            message.Body = body;
            SmtpClient client = new SmtpClient();

            // Attempt to send the email
            try
            {
                client.Send(message);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", "Issue sending email: " + e.Message);
            }
        }
        else // Email not found
        {
            ModelState.AddModelError("", "No user found by that email.");
        }
    }
    return View(resetpasswordmodel);
}
</code></pre>

<p>Here <strong>var token = WebSecurity.GeneratePasswordResetToken(member.Email);</strong> code part which is used to generate password token that will be used in the email link to authenticate user has a error for <strong>WebSecurity</strong> part. It is saying </p>

<blockquote>
  <p>The name 'WebSecurity' does not exist in the current context.</p>
</blockquote>

<p>I have added following also </p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TheFoody.Models;
using TheFoody.DataAccess;
using System.Web.Security;
using System.Web.Mail;
using System.Net.Mail;
</code></pre>

<p>I don't know how to fix this error.</p>