Please look at this code and find out why it isnt working. I am not getting an alert in the webpage. But, the console.writeLine beneath it is getting executed.
private void PublishLoop()
{
while (Running)
{
Thread.Sleep(5000);
dtMessages = (String)(Cache.Get(key));
if (dtMessages == null)
{
//publish here
dtMessages = LoadMessages();
System.Diagnostics.Debugger.Log(0,null,dtMessages);
Page.ClientScript.RegisterStartupScript(this.GetType(),"ClientScript", "alert('hi');",true);
Console.WriteLine(dtMessages);
}
}
}
Edit: You can actually only register one unique key per response. You’re running this line of code inside a while loop, so it keeps registering the same key. You need to give it a unique key parameter each time you call this function. In your case, maybe you can have a counter in your loop and append it to your key string