Response.Write and Response.Redirect

M

Matthew Wieder

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!
 
M

Matthew Wieder

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

thanks for the help.
 
K

Kevin Spencer

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.
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top