Asp.net mvc 如何在asp.net MVC中使用Authorize属性?
我需要您的帮助,我不知道如何在asp.net MVC中使用authorize属性 比如说Asp.net mvc 如何在asp.net MVC中使用Authorize属性?,asp.net-mvc,asp.net-mvc-4,authorize-attribute,Asp.net Mvc,Asp.net Mvc 4,Authorize Attribute,我需要您的帮助,我不知道如何在asp.net MVC中使用authorize属性 比如说 [Authorize] public class HomeController : Controller { // // GET: /workflow/home/ [AllowAnonymous] public ActionResult Index() { return RedirectToAction("signIn", "Accounts");
[Authorize]
public class HomeController : Controller
{
//
// GET: /workflow/home/
[AllowAnonymous]
public ActionResult Index()
{
return RedirectToAction("signIn", "Accounts");
}
public ActionResult TrackingPage()
{
return View();
}
public ActionResult profile()
{
ViewBag.profile = true;
return View();
}
public ActionResult content()
{
return View();
}
}
所有的方法都受到保护。除了索引方法,我的问题是如何授权在登录表单中正确提交用户名和密码的用户,我必须编写什么代码才能授权该用户
我是asp.net MVC新手,不习惯使用属性,我使用会话来验证用户
我不知道authorize属性是否适用于表单,还是仅适用于通过计算机管理(即windows身份验证)创建的用户
请告诉我,我有点困惑,需要您的帮助。为什么不从初学者教程中学习,例如,您要查找的代码位于visual studio为您创建的默认MVC项目中的AccountController中。特别是登录和注销方法。