как работать с «методом OPTIONS» в ASP.NET MVC

Мое приложение Sencha Touch отправляет форму на мой WebService , но вместо отправки POST он отправляет OPTIONS .

Я читаю похожую ветку здесь , но я просто не знаю, как это сделать метод OPTIONS в моем коде.

Я попытался добавить атрибут [AllowAjax] в свое действие, но, похоже, его нет в MVC3.

OPTIONS / GetInTouch / CommunicateCard HTTP / 1.1
Хост: webservice.example.com
Ссылка: http://192.168.5.206/ Метод запроса-контроля доступа: POST
Источник: http://192.168.5.206
User-Agent: Mozilla / 5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit / 534.24 (KHTML, как Gecko) Chrome / 11.0.696.71 Safari / 534.24
Заголовки-запроса-контроля доступа: X-Requested-With, Content-Type
Принять: /
Принять-кодирование: gzip, deflate, sdch
Accept-Language: en-US, en; q = 0,8
Accept-Charset: ISO-8859-1, utf-8; q = 0,7, *; q = 0,3

В моем ActionMethod я использую следующий код.

    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);
    }

14
задан Community 23 May 2017 в 12:32
поделиться