【问题标题】:ASP NET Core Identity. ReturnUrlASP NET 核心标识。返回网址
【发布时间】:2017-10-01 16:35:55
【问题描述】:

我使用 ASP NET Core + Identity。当我无权访问页面时,我得到了这个:

http://localhost:5087/Login?ReturnUrl=/Error/401

我应该如何正确获取正确的 ReturnUrl?

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseExceptionHandler("/Error");
    app.UseStatusCodePagesWithReExecute("/Error/{0}");
    app.UseStaticFiles();
    app.UseIdentity();
    app.UseMvc();
}

public IActionResult Error(string id)
{
    switch(id)
    {
        case "404":
            return File("~/errors/404.html", "text/html");
            break;         
    }
}

【问题讨论】:

标签: asp.net asp.net-mvc asp.net-core-mvc


【解决方案1】:

而不是对象return File("~/errors/404.html", "text/html"); 你想得到完整的溃败,对吧?

【讨论】:

  • 这没有提供问题的答案。要批评或要求作者澄清,请在他们的帖子下方留下评论。如果你earn足够reputation你就可以comment on any post
【解决方案2】:

随便放

[AllowAnonymous]
public IActionResult Error(string id)
{
    switch(id)
    {
        case "404":
            return File("~/errors/404.html", "text/html");
            break;         
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-22
    • 1970-01-01
    • 2021-09-19
    • 2018-10-17
    • 2020-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多