Hi,
I am trying to pass UserToken (authentication token) in ajax call for ASP.WEB API service call.
I am getting below error message.
XMLHttpRequest cannot load
http://localhost:7532/api/Common/GenerateTabs?clickedTab=null&null&_=1407319841857. Request header field UserToken is not allowed by Access-Control-Allow-Headers.
without authentication token in request header i am getting expected result.
JQuery Code
function InvokeService(url, type, successCallBack, data) {
$.ajax({
cache: false,
type: type,
url: url,
data: JSON.stringify(data),
async: false,
crossDomain: true,
headers: { 'UserToken': 'sdsdds' },
success: successCallBack
});
}
Controller
[EnableCors("*", "*", "*")]
public class CommonController : ApiController
Please help me on this.
Request and Response Headers in Chrome
Remote Address:::1:62649
Request URL:http:
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/plain, *
Ertot msg
XMLHttpRequest cannot load http://localhost:7532/api/Common/GenerateTabs?clickedTab=null&null&_=1407319841857. Request header field UserToken is not allowed by Access-Control-Allow-Headers.
Thanks
Rajesh K