我使用授权属性来检查用户是否被授权或不要进入特殊视图。使用授权属性ASP.Net MVC
[HttpGet]
[Authorize]
public ActionResult Index(int ID)
{
ViewBag.sID = ID;
return View();
}
假设这是亩URL:本地主机:16621 /面板/索引/ 1 现在,这个授权用户可以更改为1〜2,然后导航到另一个用户的信息。像本地主机:16621 /面板/索引/ 2 如何防止这种?有没有办法将参数传递给授权属性? 如何防止用户访问其他用户信息?
安吉丽娜。这已经是很多时间了。 http://stackoverflow.com/questions/2329197/custom-form-authentication-authorization-scheme-in-asp-net-mvc?rq=1 http://stackoverflow.com/questions/427598/customizing-authorization- in-asp-net-mvc?rq = 1 http://stackoverflow.com/questions/554094/asp-net-mvc-adding-to-the-authorize-attribute?rq=1 –
看看这篇文章,它正是你想要的。 http://stackoverflow.com/questions/10064631/mvc-3-access-for-specific-user-only – SOfanatic