Connecting Tech Pros Worldwide Forums | Help | Site Map

Response.Write and Response.Redirect

Matthew Wieder
Guest
 
Posts: n/a
#1: Nov 17 '05
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!


Marina
Guest
 
Posts: n/a
#2: Nov 17 '05

re: Response.Write and Response.Redirect


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

"Matthew Wieder" <Development@SatoriGroupInc.com> wrote in message
news:3F16BD25.700@SatoriGroupInc.com...[color=blue]
> 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!
>[/color]


Matthew Wieder
Guest
 
Posts: n/a
#3: Nov 17 '05

re: Response.Write and Response.Redirect


What javascript would that be?
thanks!

Marina wrote:[color=blue]
> You have to response.write some javascript to do the redirect client side.
>
> "Matthew Wieder" <Development@SatoriGroupInc.com> wrote in message
> news:3F16BD25.700@SatoriGroupInc.com...
>[color=green]
>>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!
>>[/color]
>
>
>[/color]

Matthew Wieder
Guest
 
Posts: n/a
#4: Nov 17 '05

re: Response.Write and Response.Redirect


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

thanks for the help.

Matthew Wieder wrote:[color=blue]
> What javascript would that be?
> thanks!
>
> Marina wrote:
>[color=green]
>> You have to response.write some javascript to do the redirect client
>> side.
>>
>> "Matthew Wieder" <Development@SatoriGroupInc.com> wrote in message
>> news:3F16BD25.700@SatoriGroupInc.com...
>>[color=darkred]
>>> 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!
>>>[/color]
>>
>>
>>[/color]
>[/color]

Kevin Spencer
Guest
 
Posts: n/a
#5: Nov 17 '05

re: Response.Write and Response.Redirect


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" <Development@SatoriGroupInc.com> wrote in message
news:3F16BFD8.8070003@SatoriGroupInc.com...[color=blue]
> I got it. For those interested:
> Response.Write("<script>location.href = WebPage.aspx';</script>");
>
> thanks for the help.
>
> Matthew Wieder wrote:[color=green]
> > What javascript would that be?
> > thanks!
> >
> > Marina wrote:
> >[color=darkred]
> >> You have to response.write some javascript to do the redirect client
> >> side.
> >>
> >> "Matthew Wieder" <Development@SatoriGroupInc.com> wrote in message
> >> news:3F16BD25.700@SatoriGroupInc.com...
> >>
> >>> On my Page_Load event, i need to do some validation and then either[/color][/color][/color]
let[color=blue][color=green][color=darkred]
> >>> 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[/color][/color][/color]
previous[color=blue][color=green][color=darkred]
> >>> page, the Response.Write gets eaten. How do I solve this issue?
> >>> thanks!
> >>>
> >>
> >>
> >>[/color]
> >[/color]
>[/color]


Closed Thread