467,910 Members | 1,522 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Response.Write and Response.Redirect

On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #1
  • viewed: 17848
Share:
4 Replies
You have to response.write some javascript to do the redirect client side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #2
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!



Nov 17 '05 #3
I got it. For those interested:
Response.Write("<script>location.href = WebPage.aspx';</script>");

thanks for the help.

Matthew Wieder wrote:
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client
side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...
On my Page_Load event, i need to do some validation and then either let
them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous
page, the Response.Write gets eaten. How do I solve this issue?
thanks!



Nov 17 '05 #4
Just one additional thing. Using Response.Write() is dodgy at best with
ASP.Net. Try using Page.RegisterStartupScript() instead.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**************@SatoriGroupInc.com...
I got it. For those interested:
Response.Write("<script>location.href = WebPage.aspx';</script>");

thanks for the help.

Matthew Wieder wrote:
What javascript would that be?
thanks!

Marina wrote:
You have to response.write some javascript to do the redirect client
side.

"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**********@SatoriGroupInc.com...

On my Page_Load event, i need to do some validation and then either let them proceed, or display a error message and boot them back to the
previous page. Here is the code:

Response.Write("<script>alert('Error Message here');</script>");
Response.Redirect("Configuration.aspx");

Problem is that if I call Response.Redirect to move them to the previous page, the Response.Write gets eaten. How do I solve this issue?
thanks!

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul | last post: by
3 posts views Thread by Sehboo | last post: by
3 posts views Thread by Jed | last post: by
1 post views Thread by Kevin Blount | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.