Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hey man really sorry. I haven't seen the default MVCApplication project template.</p> <p>Check it out may solve your problem.</p> <p>The control:</p> <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %&gt; &lt;script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"&gt;&lt;/script&gt; &lt;%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %&gt; &lt;% using (Ajax.BeginForm("LogOn", "Account", new AjaxOptions() { UpdateTargetId = "UpdatePanel" })) { %&gt; &lt;div id="UpdatePanel"&gt; &lt;fieldset&gt; &lt;legend&gt;Account Information&lt;/legend&gt; &lt;p&gt; &lt;label for="username"&gt; Username:&lt;/label&gt; &lt;%= Html.TextBox("username") %&gt; &lt;%= Html.ValidationMessage("username") %&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="password"&gt; Password:&lt;/label&gt; &lt;%= Html.Password("password") %&gt; &lt;%= Html.ValidationMessage("password") %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= Html.CheckBox("rememberMe") %&gt; &lt;label class="inline" for="rememberMe"&gt; Remember me?&lt;/label&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" value="Log On" /&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;% } %&gt; </code></pre> <p>The code:</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public ActionResult LogOn(string userName, string password, bool rememberMe, string returnUrl) { if (!ValidateLogOn(userName, password)) { return PartialView("Login"); } FormsAuth.SignIn(userName, rememberMe); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } </code></pre> <p>It works for me. If the problem persists, check the response and request with <a href="http://getfirebug.com" rel="nofollow noreferrer">Firebug</a>.</p> <p>Hope this helps</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload