Dynamically create JS file using ASP.net Handler

前端 未结 1 1731
眼角桃花
眼角桃花 2021-01-21 11:38

I have many clients I want to give them scripts so I want to Create JS file based on their Cusotmer ID. So I can return and it directly execute on customer side. Client can be a

相关标签:
1条回答
  • 2021-01-21 12:05

    ContentType should be application/javascript

    public void ProcessRequest(HttpContext context)
    {
        string CustomerId = context.Request["CustomerId"].ToString();
        string jscontent = JSFileWriter.GetJS(CustomerId); // This function will return my custom js string
    
        context.Response.ContentType = "application/javascript";
        context.Response.Write(jscontent);
    }
    
    0 讨论(0)
提交回复
热议问题