I want to add some custom HTTP headers onto a ASP.Net web service to allow cross site access.
the result I need is something like this. i.e,
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: X-Requested-With
Access-Control-Max-Age: 86400
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope >
<soap:Body>
.....
</soap:Body>
</soap:Envelope>
I tried this but it doesn't work
<WebMethod()> _
Public Function SomeMethod(blabla...) As Something
...
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*")
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "X-Requested-With")
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "86400")
...
End Function
I'm using Don.Net 2.0
any idea? thanks in advance.