title: how to handle "OPTIONS Method" in ASP.NET MVC
body: <p>My Sencha Touch app is posting a form to my <a href="/questions/tagged/asp.net-mvc-3" class="post-tag" title="show questions tagged &#39;asp.net-mvc-3&#39;" rel="tag">asp.net-mvc-3</a> WebService, but instead of sending <code>POST</code> it's sending <code>OPTIONS</code>.</p>
  
  <p>I'm reading a similar thread <a href="https://stackoverflow.com/questions/4875195/problem-sending-json-data-from-jquery-to-wcf-rest-method">here</a>, but I just don't know how to handle the <code>OPTIONS</code> method in my code.</p>
  
  <p><em>I did try adding the <code>[AllowAjax]</code> attribute to my Action, however it doesn't seem to exist in MVC3.</em></p>
  
  <blockquote>
    <blockquote>
      <p><strong>OPTIONS /GetInTouch/CommunicateCard HTTP/1.1</strong><br>
      Host: webservice.example.com<br>
      Referer: <a href="http://192.168.5.206/" rel="nofollow noreferrer">http://192.168.5.206/</a>
      Access-Control-Request-Method: POST<br>
      Origin: <a href="http://192.168.5.206" rel="nofollow noreferrer">http://192.168.5.206</a><br>
      User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/534.24 (KHTML, like Gecko)   Chrome/11.0.696.71 Safari/534.24<br>
      Access-Control-Request-Headers: X-Requested-With, Content-Type<br>
      Accept: <em>/</em><br>
      Accept-Encoding: gzip,deflate,sdch<br>
      Accept-Language: en-US,en;q=0.8<br>
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3  </p>
    </blockquote>
  </blockquote>
  
  <p>In my ActionMethod, I'm using the following code.</p>
  
  <pre><code>    public JsonpResult CommunicateCard(CommunicateCard communicateCard)
      {
  
          // Instantiate a new instance of MailMessage
          MailMessage mMailMessage = new MailMessage();
  
          // removed for security/brevity
  
          // Set the body of the mail message
          mMailMessage.Body = communicateCard.name; // THIS IS CURRENTLY BLANK :-(
  
          // removed for security/brevity
          mSmtpClient.Send(mMailMessage);
  
          // do server side validation on form input
          // if it's valid return true
          // else return false
          // currently returning NULL cuz I don't care at this point.
          return this.Jsonp(null);
      }
  </code></pre>