Динамически создавать JS-файл, используя ASP.net Handler
У меня есть много клиентов, которым я хочу дать им сценарии, поэтому я хочу создать файл JS на основе их идентификатора Cusotmer. Так что я могу вернуться, и это непосредственно выполнить на стороне клиента. Клиентом может быть любой либо PHP, Html, ASP.net
Problem is when i browse this link it give me JS string but on customer side this script is not executing like for testing I put alert this alert is not showing on customer side
Покупатель
<head>
<script src="http://localhost:12604/JSCreator/Handler.ashx?CustomerID=123" type="text/javascript"></script>
<title></title>
</head>
Файл обработчика
public class Handler : IHttpHandler
{
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 = "text/javascript";
context.Response.Write(jscontent);
}
public bool IsReusable
{
get
{
return false;
}
}
}