title: how to serve javascript wtih asp.net page?
body: <p>I don't know if the title is clear enough or not, but let me explain what I'm trying to do.</p>
  
  <p>I have two webapps with written in asp.net with C#. </p>
  
  <p>App A has the following html.</p>
  
  <pre><code>&lt;script type="text/javascript" id="blah" src="http://somServer/AppB/page.aspx?p=q"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>App B receives above request and needs to inject javascript dynamically to the script tag above. I have the following code in App B's page.aspx but it doesn't work. I need App B to return pure javascript, not html.</p>
  
  <pre><code>namespace AppB
  {
      public partial class Default : System.Web.UI.Page
      {
         if(!Page.IsPostBack)
         {
           Response.Clear();
           Response.ClearContent();
           REsponse.ClearHeader();
           Response.AddHeader("content-type", "text/javascript");
           var p = Request.Query["p"];
           if(!string.IsNullOrEmpty(p))
           {
              this.Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "test", "alert('test');", false");
           }
       }
  }
  </code></pre>