Problem with "Cannot redirect after http headers have beent sent" error

G

Guest

In my Page_Load Method, I call a method by asynchronous callback to do some work. It's working fine until it calls back. Here is the problem in my callback method. Basically, I cannot redirect because it keeps on saying that the http headers has already been sent. It looks like it keeps on telling me that the response is complete. So nothing it could do about it. I really don't understand. Here is my code (in the callback method):

//this.CurrentContext.Response.Clear();
this.CurrentContext.Response.Redirect(this.CurrentContext.Request.ApplicationPath+"/DesktopDefault.aspx?tabindex="+this.CurrentContext.Request.Params["tabindex"]+"&tabid="+this.CurrentContext.Request.Params["tabid"]);

As you could see, I tried to clear the response first as well. Then the response.redirect won't even be evaluated.

If anyone has answer to this, please let me know. Thank you so much in advance

Also, if you anyone could provide or direct me to explanation of what's going on when I use thread in ASP.NET, I'd be really appreciated. Thank you.
 
P

Peter Rilling

Turns out the aspnet_client folder did not exist under the root of our site.
Once we added it, things started working.

chsakda said:
In my Page_Load Method, I call a method by asynchronous callback to do
some work. It's working fine until it calls back. Here is the problem in my
callback method. Basically, I cannot redirect because it keeps on saying
that the http headers has already been sent. It looks like it keeps on
telling me that the response is complete. So nothing it could do about it. I
really don't understand. Here is my code (in the callback method):
//this.CurrentContext.Response.Clear();
this.CurrentContext.Response.Redirect(this.CurrentContext.Request.Applicatio
nPath+"/DesktopDefault.aspx?tabindex="+this.CurrentContext.Request.Params["t
abindex"]+"&tabid="+this.CurrentContext.Request.Params["tabid"]);

As you could see, I tried to clear the response first as well. Then the
response.redirect won't even be evaluated.
If anyone has answer to this, please let me know. Thank you so much in advance.

Also, if you anyone could provide or direct me to explanation of what's
going on when I use thread in ASP.NET, I'd be really appreciated. Thank you.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top