simply make use of <% %> tag
<![CDATA[<%
if(window.name == ''){
if(!SOME_VALUE_SET_FOR_2ND_TO_NTH_LOADS){
window.name = 'myWinName';
} else {
alert('What?! One window not cool enough for ya?\n' +
'Calling the InterWeb Police!');
}
} else if(window.name == 'myWinName'){
document.title = 'All is well... we think';
}
%>]]>
SHDocVw.ShellWindows shellWindows1 = new SHDocVw.ShellWindows();
foreach (SHDocVw.InternetExplorer ieInst in shellWindows1)
{
String str = "<script>if(window.name == ''){if(!SOME_VALUE_SET_FOR_2ND_TO_NTH_LOADS){window.name = 'myWinName';} else {alert('What?! One window not cool enough for ya?\n' +'Calling the InterWeb Police!');} } else if(window.name == 'myWinName'){document.title = 'All is well... we think';}</script>";
Page x=new Page();
Program p = new Program();
x.ClientScript.RegisterStartupScript(p.GetType(), "Script", str, false);
System.Console.WriteLine(ieInst.LocationURL+"\t");
}
foreach (Process theprocess in Process.GetProcesses("."))
{
if (theprocess.ProcessName == "iexplore")
{
Console.WriteLine("Process: {0}\tID: {1}\tWindow name: {2}",
theprocess.ProcessName, theprocess.Id, theprocess.MainWindowTitle + "\t" + theprocess.StartTime
);
}
}