Response.Write and Response.Redirect

Discussion in 'ASP .Net' started by Matthew Wieder, Jul 17, 2003.

  1. 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!
     
    Matthew Wieder, Jul 17, 2003
    #1
    1. Advertising

  2. Matthew Wieder

    Marina Guest

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

    "Matthew Wieder" <> wrote in message
    news:...
    > 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, Jul 17, 2003
    #2
    1. Advertising

  3. What javascript would that be?
    thanks!

    Marina wrote:
    > You have to response.write some javascript to do the redirect client side.
    >
    > "Matthew Wieder" <> wrote in message
    > news:...
    >
    >>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!
    >>

    >
    >
    >
     
    Matthew Wieder, Jul 17, 2003
    #3
  4. 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" <> wrote in message
    >> news:...
    >>
    >>> 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!
    >>>

    >>
    >>
    >>

    >
     
    Matthew Wieder, Jul 17, 2003
    #4
  5. 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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > >> news:...
    > >>
    > >>> 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!
    > >>>
    > >>
    > >>
    > >>

    > >

    >
     
    Kevin Spencer, Jul 17, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    2
    Views:
    8,018
    Charles A. Lackman
    Jan 11, 2006
  2. Sehboo
    Replies:
    3
    Views:
    8,811
    Sehboo
    Dec 10, 2003
  3. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,254
    Srowe1975
    Oct 15, 2008
  4. slawekg

    Response.Write and Response.Redirect

    slawekg, Jun 21, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    381
    Alexey Smirnov
    Jun 21, 2007
  5. Sal
    Replies:
    1
    Views:
    513
Loading...

Share This Page