its probably just me being dumb, but any case, here goes:
I am coding a project using MVC5. On the login form I have options for external login which look like this:

The CSHTML for the external login portion of the form is as follows:
The buttons work perfectly, but I prefer the styling of the <a> tags. When I submit using those, the provider is not passed to the ExternalLogin method in the controller.
When clicking the button I can clearly see Account/ExternalLogin?provider=Facebook hitting the controller.
I am stumped by how to make sure this the provider variable is set before calling the .submit method for the form.
I am coding a project using MVC5. On the login form I have options for external login which look like this:

The CSHTML for the external login portion of the form is as follows:
Code:
<div class="login-options">
@using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = ViewBag.ReturnUrl }))
{
@Html.AntiForgeryToken()
<h4>Or login with</h4>
<ul class="social-icons">
<li>
<a class="facebook" id="Facebook" name="provider" value="Facebook" href="#"
onclick="$(this).closest('form').submit()"></a>
</li>
<li>
<button type="submit" class="facebook" name="provider" value="Facebook" title="Log in using your
Facebook account" />
</li>
<li>
<a class="googleplus" id="GooglePlus" name="provider" value="Google" href="#"
onclick="$(this).closest('form').submit()" ></a>
</li>
<li>
<button type="submit" class="googleplus" name="provider" value="Google" title="Log in using your
Google account" />
</li>
</ul>
}
</div>
The buttons work perfectly, but I prefer the styling of the <a> tags. When I submit using those, the provider is not passed to the ExternalLogin method in the controller.
When clicking the button I can clearly see Account/ExternalLogin?provider=Facebook hitting the controller.
I am stumped by how to make sure this the provider variable is set before calling the .submit method for the form.
Last edited: