Asp.net mvc Owin ExternalLogin之后的重定向操作将#哈希添加到url

Asp.net mvc Owin ExternalLogin之后的重定向操作将#哈希添加到url,asp.net-mvc,oauth-2.0,owin,Asp.net Mvc,Oauth 2.0,Owin,在使用google auth登录并重定向到home/index后,我在url中添加了一个散列 现在我注意到,StackOverflow.com有一个类似的东西,在我使用facebook登录后,我被重定向到: http://stackoverflow.com/#_=_ 我的控制器代码非常标准: [AllowAnonymous] public async Task<ActionResult> ExternalLoginCallback(string returnUrl) { va

在使用google auth登录并重定向到home/index后,我在url中添加了一个散列

现在我注意到,
StackOverflow.com
有一个类似的东西,在我使用facebook登录后,我被重定向到:

http://stackoverflow.com/#_=_

我的控制器代码非常标准:

[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
    var loginInfo = await HttpContext.GetOwinContext().Authentication.GetExternalLoginInfoAsync();
    if (loginInfo == null)
    {
        return Content("failed");
    }
    // removed rest of the code to identify problem  
    return RedirectToAction("Index", "Home");
}
[AllowAnonymous]
公共异步任务ExternalLoginCallback(字符串返回URL)
{
var loginInfo=await HttpContext.GetOwinContext().Authentication.getexternallogininfosync();
if(loginInfo==null)
{
返回内容(“失败”);
}
//删除了代码的其余部分以识别问题
返回重定向到操作(“索引”、“主页”);
}

有人知道为什么这个散列会出现在Url中吗?我可以去掉它吗?

在OAuth过程中没有设置重定向uri时,为了安全起见添加了这个片段。请参阅:@ChrisPratt谢谢,您应该添加此作为答案