response.redirect

how can i response.redirect after doing a response.flush? i keep getting cannot redirect after http headers has been send?

thanks

alain
LVL 1
alain123Asked:
Who is Participating?
 
gregoryyoungConnect With a Mentor Commented:
yes basically you write out the javascript from the server to tell the broswer to redirect ...
0
 
gregoryyoungCommented:
this is correct because the headers are used to do the redirect ...

you could write out javascript to do the redirect
0
 
alain123Author Commented:
hmm. the redirect needs to be done on the server side..
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
msdixonCommented:
Response.Write("<script language=\"javascript\">document.location = 'yourUrlHere.aspx'</script>");
0
 
AdrianJMartinCommented:
use a javascript to redirect the browser, when you use the Server.Redirect, asp.net actually post a header to the browser to request that the browser redirects to another location:-

<META HTTP-EQUIV="Refresh" CONTENT="0;URL=rediretedpage.htm">  this is in the headwer section of response.

technically you should include the full url on the internet as some browsers can decide not to handle the redirect based on securty settings.

the following javascript can be written to the response at any time will be actioned as soon as the browser parses it

<script language=javascript>
<!--
location.replace("page1.htm")
//-->
0
 
msdixonCommented:
isn't that what i said? how is that different?
0
 
gregoryyoungCommented:
its what I had said previously as well ...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.