Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これが動的な応答である場合、私は単純に実行しますResponse.Headers.Add("Access-Control-Allow-Origin", "*");が、クロスドメインアクセスを許可したい静的ファイルがあります。
Response.Headers.Add("Access-Control-Allow-Origin", "*");
web.configを使用してこのヘッダーを特定のファイルに割り当てる方法はありますか?ただのexample.com/flat.jsonだと言ってください
ファイルを動的ページにルーティングできると思いますが、それは少しばかげています。
これはうまくいくはずです
<location path="Sample.txt"> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> </system.webServer> </location>