ASP.net loading page

S

Sontek

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top