How to prevent ASP.NET Identity from logging in from # to the end of the URL?

Normally this would not matter, but I am creating an AngularJS application, and #, added by an external ASP.NET Identity input (based on OWIN), breaks the chaos in the angularjs application.

You can even see it on the new default C # ASP.NET MVC site with Google without commenting in Startup.Auth.cs.

A # is added to the end of the URL when the user logs in and is redirected. I tried to manage this redirect myself, but to no avail ... a hash tag is always added.

Any ideas? Thanks in advance.

Update

The default solution uses a form to trigger an external login, for example:

using (Html.BeginForm(action, "Account", new { ReturnUrl = returnUrl }))
{
    @Html.AntiForgeryToken()
    <div id="socialLoginList">
        <p>
        @foreach (AuthenticationDescription p in loginProviders)
        {
            <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button>
        }
        </p>
    </div>
}

I don’t see anything in this add request #.

"", , :

private ActionResult RedirectToLocal(string returnUrl) {
    if (Url.IsLocalUrl(returnUrl)) {
        return Redirect(returnUrl);
    }
    else {
        return RedirectToAction("Index", "Home");
    }
}

return RedirectToAction("Index", "Home"); # URL-.

: return Redirect("/home/index");, # .

2 , Chrome.

+3
1

, .

( , Chrome). , , OAuthAuthorizationServerHandler.ApplyResponseGrantAsync

var appender = new Appender(location, '#');
appender
    .Append(Constants.Parameters.AccessToken, accessToken)
    .Append(Constants.Parameters.TokenType, Constants.TokenTypes.Bearer);

, , , , : '#', .

, , AngularJS, # Hashbang #!. , :

<!DOCTYPE html>
<html lang="en">
<head>
    <script>window.location.replace('/#!/' + window.location.hash);</script>
    <meta charset="utf-8">
    <title>Please wait.</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>Please wait.</body>
</html>

, .

+2

All Articles