Access-Control-Allow-Origin in ASP

2020-03-04 02:26发布

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."

1条回答
小情绪 Triste *
2楼-- · 2020-03-04 02:54

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

查看更多
登录 后发表回答