从aspx后台页面向浏览器输出js文件

从aspx后台页面输出js文件

Response.Clear();
Response.Charset 
= "utf-8";
Response.Buffer 
= true;
            
Response.ContentEncoding 
= System.Text.Encoding.UTF8;
Response.AddHeader(
"Content-Disposition""attachment;filename=js.js");
Response.ContentType 
= "application/octet-stream";
Response.Write(
"<script>alert('aaa');</script>");            
Response.End();

原文地址:https://www.cnblogs.com/didi/p/1446324.html