Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET 3.0授权失败的路由_C#_Asp.net_Model View Controller_Routes_Authorize - Fatal编程技术网

C# ASP.NET 3.0授权失败的路由

C# ASP.NET 3.0授权失败的路由,c#,asp.net,model-view-controller,routes,authorize,C#,Asp.net,Model View Controller,Routes,Authorize,我想知道当一个用户在网页上没有被授权时,什么是最好的优雅处理方式。在3.0版本中,微软引入了用户标识区的概念,但[Authorize()]似乎还没有迁移过来。我的意思是: [Authorize(Roles = "Admin")] public class IndexMode : PageModel { 如果用户导航到此页面,则默认为“/Account/Login?ReturnUrl=%2FHome%2Findex” 但在3.0中应该是:“/Identity/Account/Login?Retu

我想知道当一个用户在网页上没有被授权时,什么是最好的优雅处理方式。在3.0版本中,微软引入了用户标识区的概念,但[Authorize()]似乎还没有迁移过来。我的意思是:

[Authorize(Roles = "Admin")]
public class IndexMode : PageModel
{
如果用户导航到此页面,则默认为“/Account/Login?ReturnUrl=%2FHome%2Findex” 但在3.0中应该是:“/Identity/Account/Login?ReturnUrl=%2FHome%2Findex”

现在之所以这样做是因为使用未经授权,所以他们可能需要登录(但可能用户未经授权)

处理这两个基本情况的最佳方法是什么