我的劇本是AngularJS HTTP請求不發送會話cookie的CORS
GET http://example.com/api/Event HTTP/1.1
Host: example.com
Connection: keep-alive
Cache-Control: max-age=0
Accept: application/json, text/plain, */*
Origin: http://www.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
Referer: http://www.example.com/Home/Event
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
我需要一個認證會話cookie來這個請求被髮送。
只有當網頁的網址前面沒有www時纔會發送cookie。
我在此網站上發現了類似的問題,答案是:
.config(function ($routeProvider, $httpProvider) {
$httpProvider.defaults.withCredentials = true;
//rest of route code
但我在哪裏把這個代碼在我的劇本?
我正在開發Web應用程序與網頁API的ASP.NET應用程序MVC5 2.