What i'm trying to do is create a page with a loading image on it, Then
I'll start a method in a new thread that does all the work and then
fires an event which will redirect the page. Heres my code:
public partial class quote_Loading : System.Web.UI.Page
{
private delegate void LoadCompleteHandler();
private event LoadCompleteHandler LoadComplete;
protected void Page_Load(object sender, EventArgs e)
{
this.LoadComplete += new
LoadCompleteHandler(quote_Loading_LoadComplete);
}
void quote_Loading_LoadComplete()
{
Response.Redirect("loaded.aspx");
}
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
System.Threading.Thread thread = new
System.Threading.Thread(new System.Threading.ThreadStart(Threads));
thread.Start();
}
public void Threads()
{
System.Threading.Thread.Sleep(1000);
this.LoadComplete();
}
}
With that code I get:
Response is not available in this context.
So then I try it with Context.Response.Redirect and I get:
Cannot redirect after HTTP headers have been sent.
I've tried clearing out the heads and everything but I have no other
idea how to get it to work :P