I have a "DOM" file that calls an ASP file (NOT .NET) on another domain.
How do I write the Access-Control-Allow-Origin
in ASP?
Access-Control-Allow-Origin
is for "PHP" but I cant find the syntax for ASP, I can only find it for ASP.NET
It works fine when I use Internet Explorer but in Chrome it says
"No Access-Control-Allow-Origin
header is present on the requested resource. Origin 'http://SOURCEDOMAIN' is therefore not allowed access."
Adding HTTP headers into a Classic ASP is a trivial process, the Response
object has a method specifically for this purpose that allows you to add any custom header you want into the HTTP Headers that will be sent to the browser when the page is requested.
The method is called AddHeader()
here is an example;
<%
Call Response.AddHeader("Access-Control-Allow-Origin", "http://SOURCEDOMAIN")
%>
Useful Links
- W3 - Cross-Origin Resource Sharing
- Cross-domain Ajax with Cross-Origin Resource Sharing
- Using CORS