title: ASP.NET MVC SSL POST Error
body: <p>I have a Logon page in a MVC (1.0) application that I am securing with SSL, I have an attribute that inspects the request for the page and redirects to a https uri when it is requested with http.  This all works, however when I post the form content i get the following error:</p>
  
  <blockquote>
    <p>The parameters dictionary contains a
    null entry for parameter 'rememberMe'
    of non-nullable type 'System.Boolean'
    for method
    'System.Web.Mvc.ActionResult
    LogOn(System.String, System.String,
    Boolean, System.String)' in
    'DAC.US.Web.Portal.Controllers.AccountController'.
    To make a parameter optional its type
    should be either a reference type or a
    Nullable type. Parameter name:
    parameters</p>
  </blockquote>
  
  <p>here is the controller code... </p>
  
  <pre><code>    //
      // GET: /Account/LogOn
      [RequiresSSL]
      public ActionResult LogOn(string ReturnUrl)
      {
          if (TempData["Message"] != null)
              ViewData["Message"] = TempData["Message"];
  
          TempData["Message"] = null;
  
          ViewData["ReturnUrl"] = ReturnUrl ?? "/Home"; 
  
          return View();
      }
  </code></pre>
  
  <p>Again, the RequireSSL Attribute works, but the POST from that SSL uri does not.  What is not working?</p>
  
  <p>Here is the Action (POST) Method, I apologize for not posting.  This all works file when not running as SSL, but when i change to run under SSL the POST's do not work anymore.</p>
  
  <pre><code>    //
      // POST: /Account/LogOn
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult LogOn(string userName, string password, bool rememberMe, string returnUrl)
      {
          Logger.InfoFormat("LogOn : ({0}, PASSWORD, {1}, {2}).", userName, rememberMe, returnUrl);
          if (!ValidateLogOn(userName, password))
          {
              return View();
          }
  
          _FormsAuthentication.SignIn(userName, rememberMe);
  
          if (!String.IsNullOrEmpty(returnUrl))
          {
              return Redirect(this.Request.Url.AbsoluteUri.Replace(this.Request.RawUrl, returnUrl).Replace("https://", "http://"));
          }
          else
          {
              return Redirect(this.Request.Url.AbsoluteUri.Replace(this.Request.RawUrl, "/Home").Replace("https://", "http://"));
              //return RedirectToAction("Index", "Home");
          }
      }
  </code></pre>
  
  <p>Form HTML</p>
  
  <pre><code>                        &lt;% using (Html.BeginLogOnForm()){ %&gt;
                              &lt;div class="logon-row logon-sso-row"&gt;
                                  &lt;div class="logon-links-row"&gt;&lt;a href="&lt;%=Url.Action("SingleSignOn", "Account", new{ReturnUrl=ViewData["ReturnUrl"]}) %&gt;"&gt;Single Sign On&lt;/a&gt;&lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="logon-row"&gt;
                                  &lt;span class="block-span logon-label-cell"&gt;User Name:&lt;/span&gt;
                                  &lt;span class="block-span"&gt;&lt;%= Html.TextBox("username", null, new { style = "width:150px" })%&gt;&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;div class="logon-row"&gt;
                                  &lt;span class="block-span logon-label-cell"&gt;Password:&lt;/span&gt;
                                  &lt;span class="block-span"&gt;&lt;%= Html.Password("password", null, new { style="width:150px" })%&gt;&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;div class="logon-row"&gt;
                                  &lt;span class="block-span logon-label-cell"&gt;Remember Me?:&lt;/span&gt;
                                  &lt;span class="block-span"&gt;&lt;%= Html.CheckBox("rememberMe")%&gt;&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;div class="logon-row logon-bottons-row"&gt;
                                  &lt;input type="submit" value="Log On" class="mainshipButton mainshipPageButton" /&gt;
                              &lt;/div&gt;
                              &lt;div class="logon-row"&gt;
                                  &lt;div class="logon-links-row"&gt;&lt;a href="&lt;%=Url.Action("Request", "Account") %&gt;"&gt;Request Account&lt;/a&gt;&lt;/div&gt;
                                  &lt;div class="logon-links-row"&gt;&lt;a href="&lt;%=Url.Action("Forgot", "Account") %&gt;"&gt;Forgot ID/Password&lt;/a&gt;&lt;/div&gt;
                              &lt;/div&gt;
                          &lt;% } %&gt;
  </code></pre>