G
Guest
Hi,
I am trying to add some server side code in some Client Side Script. I can
get it to work properly with the code embedded directly in the .aspx page.
However, if I try to use the Page.ClientScript.RegisterClientScriptBlock I
get an error and the code does not execute.
Here is an example:
protected void Page_Load(object sender, EventArgs e)
{
FileStream strm = File.OpenRead("<<Path to Script goes here>>");
StreamReader rdr = new StreamReader(strm);
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OCL",
rdr.ReadToEnd());
}
-- Script in File. --
<script language="javascript" type="text/javascript">
function GetClientIPAddress()
{
alert("<%
Response.Write(Request.ServerVariables["REMOTE_ADDR"].ToString()); %>");
}
<script/>
Any ideas?
Thanks,
- Mike
I am trying to add some server side code in some Client Side Script. I can
get it to work properly with the code embedded directly in the .aspx page.
However, if I try to use the Page.ClientScript.RegisterClientScriptBlock I
get an error and the code does not execute.
Here is an example:
protected void Page_Load(object sender, EventArgs e)
{
FileStream strm = File.OpenRead("<<Path to Script goes here>>");
StreamReader rdr = new StreamReader(strm);
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OCL",
rdr.ReadToEnd());
}
-- Script in File. --
<script language="javascript" type="text/javascript">
function GetClientIPAddress()
{
alert("<%
Response.Write(Request.ServerVariables["REMOTE_ADDR"].ToString()); %>");
}
<script/>
Any ideas?
Thanks,
- Mike