как авторизация asp (mvc) проекта с контроллера?
Я новичок в asp и создал страницу входа для своего веб-проекта, но я установил аутентификацию, но не могу установить авторизацию для своего проекта! Я видел много ссылок, как этоАутентификация и авторизация в ASP.NET Web API но не смог реализовать их на своем собственном проекте, я не знаю с чего начать ?! Спасибо за помощь!
это мой контроллер:
public class AuthenticationController : Controller
{
private modelLayOut mLO = new modelLayOut();
public bool existBool = false;
// GET: Authentication
public ActionResult Index()
{
return View();
}
public ActionResult applicantAuthentication()
{
return View("ApplicantAuthentication");
}
public ActionResult applicantIsExist()
{
return View("applicantIsExist");
}
public ActionResult applicantPassIsWrong()
{
return View("applicantPassIsWrong");
}
public ActionResult applicantNotExist()
{
return View("applicantNotExist");
}
[HttpPost]
public ActionResult applicantCreate(string Username, string Password, string RepeatPassword)
{
if (mLO.applicantExistCheck(Username))
{
return View("applicantIsExist");
}
else
{
mLO.insertNewApplicant(Username, Password);
return View("ApplicantAuthentication");
}
}
[HttpPost]
public ActionResult applicantAccess(string Username, string Password)
{
if (mLO.applicantAccess(Username, Password))
{
return RedirectToAction("Home", "Home");
}
else
{
if (mLO.applicantExistCheck(Username))
{
return View("applicantPassIsWrong");
}
else
{
return View("applicantNotExist");
}
}
}
//agency part
public ActionResult agencyAuthentication()
{
return View("AgencyAuthentication");
}
public ActionResult agencyPassIsWrong()
{
return View("agencyPassIsWrong");
}
public ActionResult agencyNotExist()
{
return View("agencyNotExist");
}
[HttpPost]
public ActionResult agencyAccess(string Username, string Password)
{
if (mLO.agencyAccess(Username, Password))
{
return RedirectToAction("Home", "Home");
}
else
{
if (mLO.agencyExistCheck(Username))
{
return View("agencyPassIsWrong");
}
else
{
return View("agencyNotExist");
}
}
}
//webAdmin
public ActionResult webAdminAuthentication()
{
return View("WebAdminAuthentication");
}
public ActionResult webAdminAccessWrong()
{
return View("webAdminAccessWrong");
}
[HttpPost]
public ActionResult webAdminAccess(string Username, string Password)
{
if (mLO.webAdminAccess(Username, Password))
{
Session["Username"] = Username;
return RedirectToAction("webAdminPage", "Admin");
}
else
{
return View("webAdminAccessWrong");
}
}