Home External ASP.NET MVC 5 Identity login throws System.ArgumentNullException
Reply: 0

External ASP.NET MVC 5 Identity login throws System.ArgumentNullException

user8425 Published in September 20, 2018, 5:20 pm

I use external authentication in my ASP.NET MVC 5 Identity web application. The authentication is implemented using Google account. The registration process goes just fine using Google account, but when I try to log-in (already been registered previously) an exception occurs in this part of code: var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false); The whole code snippet goes just like this:

public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
    var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
    if (loginInfo == null)
        return RedirectToAction("Login");

    try//just to catch an exception in the next line
        var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);

        switch (result)
            case SignInStatus.Success:
                return RedirectToLocal(returnUrl);
            case SignInStatus.LockedOut:
                return View("Lockout");
            case SignInStatus.RequiresVerification:
                return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false });
            case SignInStatus.Failure:
                // If the user does not have an account, then prompt the user to create an account
                ViewBag.ReturnUrl = returnUrl;
                ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
                return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });

    catch (Exception e)
        return View();

The exception is this:

Message: The value can not be undefined!

ParamName: "value"

Source: mscorlib

..though I don't have any "value" properties in 'loginInfo' variable to be undefined!

share|improve this question
  • Generally speaking Stack Overflow is handled in English. The exception in your pic is in a Cyrillic language. Translate it first and ask for help with that message. Additionally, you can directly insert a picture into a Stack Overflow post instead of linking out to a picture. This way, if the picture eventually goes away, then the post doesn't get a broken link. – 010110110101 Feb 13 at 19:20
  • I translated the exception message info...concerning the picture, I couldn't insert it directly because of rep or whatever there is – Arthur Bardakov Feb 13 at 21:21

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303392 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO