I have a Page.aspx. I would like to inject a <script> tag into the response stream of Page.aspx, after it has finished writing its output. How could I do this form within the codebehind of Page?
If I do this:
protected void Page_Load(object sender, EventArgs e)
{
this.ClientScript.RegisterClientScriptInclude
("dfasfds", this.Request.Path.Replace(".aspx", ".js"));
}
Then the script appears in the HTML response, but not at the end.
If I do this:
protected void Page_Load(object sender, EventArgs e)
{
this.Response.Flush();
this.Response.Write(.../*my javascript*/...);
}
Then the <script> tag appears at the very beginnning of the document, on the first line.