Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:42 PM
JC
Guest
 
Posts: n/a
Default Question about Response.Redirect

Hi,

I have a simple question regarding the Response.Redirect method. Does the
server stop processing the ASP code as soon as it encounters the Redirect
command? Or does it ever continue to process the page?

Basically, with the following code:

[....]
Response.Redirect("../newpage.asp")
Response.Write "This will crash: " & 1/0

It seems that the server sends the redirection header to the client as soon
as it hits the .Redirect line, and stops processing that page. I do not
receive a divide by zero error.

Is this always the expected behavior?

Also, someone mentioned in a previous thread that the correct syntax to use
is

Response.Redirect "http://someurl.com"
Response.End

What would happen if someone omitted to send a Response.End command?

Thanks in advance.

JC


  #2  
Old July 19th, 2005, 01:42 PM
Mike
Guest
 
Posts: n/a
Default Re: Question about Response.Redirect

in your first code snippet the response.write will never execute because the
page is redirected. it will always work like that. As for the second snippet
if you have response.end or not after a redirect doesn't matter. The
redirect will still execute

"JC" <nospam@here.com> wrote in message
news:u8lHA7YTEHA.320@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi,
>
> I have a simple question regarding the Response.Redirect method. Does the
> server stop processing the ASP code as soon as it encounters the Redirect
> command? Or does it ever continue to process the page?
>
> Basically, with the following code:
>
> [....]
> Response.Redirect("../newpage.asp")
> Response.Write "This will crash: " & 1/0
>
> It seems that the server sends the redirection header to the client as[/color]
soon[color=blue]
> as it hits the .Redirect line, and stops processing that page. I do not
> receive a divide by zero error.
>
> Is this always the expected behavior?
>
> Also, someone mentioned in a previous thread that the correct syntax to[/color]
use[color=blue]
> is
>
> Response.Redirect "http://someurl.com"
> Response.End
>
> What would happen if someone omitted to send a Response.End command?
>
> Thanks in advance.
>
> JC
>
>[/color]


  #3  
Old July 19th, 2005, 01:42 PM
Steven Burn
Guest
 
Posts: n/a
Default Re: Question about Response.Redirect

http://aspfaq.com/show.asp?id=2217
http://aspfaq.com/show.asp?id=2011

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"JC" <nospam@here.com> wrote in message
news:u8lHA7YTEHA.320@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi,
>
> I have a simple question regarding the Response.Redirect method. Does the
> server stop processing the ASP code as soon as it encounters the Redirect
> command? Or does it ever continue to process the page?
>
> Basically, with the following code:
>
> [....]
> Response.Redirect("../newpage.asp")
> Response.Write "This will crash: " & 1/0
>
> It seems that the server sends the redirection header to the client as[/color]
soon[color=blue]
> as it hits the .Redirect line, and stops processing that page. I do not
> receive a divide by zero error.
>
> Is this always the expected behavior?
>
> Also, someone mentioned in a previous thread that the correct syntax to[/color]
use[color=blue]
> is
>
> Response.Redirect "http://someurl.com"
> Response.End
>
> What would happen if someone omitted to send a Response.End command?
>
> Thanks in advance.
>
> JC
>
>[/color]


  #4  
Old July 19th, 2005, 01:42 PM
Steven Burn
Guest
 
Posts: n/a
Default Re: Question about Response.Redirect

I was always told to stick Response.End after it (never told why mind).....?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"Mike" <anonymous@discussions.microsoft.com> wrote in message
news:edrnWGZTEHA.3872@TK2MSFTNGP10.phx.gbl...[color=blue]
> in your first code snippet the response.write will never execute because[/color]
the[color=blue]
> page is redirected. it will always work like that. As for the second[/color]
snippet[color=blue]
> if you have response.end or not after a redirect doesn't matter. The
> redirect will still execute
>
> "JC" <nospam@here.com> wrote in message
> news:u8lHA7YTEHA.320@TK2MSFTNGP10.phx.gbl...[color=green]
> > Hi,
> >
> > I have a simple question regarding the Response.Redirect method. Does[/color][/color]
the[color=blue][color=green]
> > server stop processing the ASP code as soon as it encounters the[/color][/color]
Redirect[color=blue][color=green]
> > command? Or does it ever continue to process the page?
> >
> > Basically, with the following code:
> >
> > [....]
> > Response.Redirect("../newpage.asp")
> > Response.Write "This will crash: " & 1/0
> >
> > It seems that the server sends the redirection header to the client as[/color]
> soon[color=green]
> > as it hits the .Redirect line, and stops processing that page. I do not
> > receive a divide by zero error.
> >
> > Is this always the expected behavior?
> >
> > Also, someone mentioned in a previous thread that the correct syntax to[/color]
> use[color=green]
> > is
> >
> > Response.Redirect "http://someurl.com"
> > Response.End
> >
> > What would happen if someone omitted to send a Response.End command?
> >
> > Thanks in advance.
> >
> > JC
> >
> >[/color]
>
>[/color]


  #5  
Old July 19th, 2005, 01:42 PM
JC
Guest
 
Posts: n/a
Default Re: Question about Response.Redirect

That's wonderful, this first link contained all the information I could wish
for.

Cheers,

JC


"Steven Burn" <pvt@noyb.com> wrote in message
news:exEK7IZTEHA.3968@TK2MSFTNGP09.phx.gbl...[color=blue]
> http://aspfaq.com/show.asp?id=2217
> http://aspfaq.com/show.asp?id=2011
>
> --
>
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
>
> "JC" <nospam@here.com> wrote in message
> news:u8lHA7YTEHA.320@TK2MSFTNGP10.phx.gbl...[color=green]
> > Hi,
> >
> > I have a simple question regarding the Response.Redirect method. Does[/color][/color]
the[color=blue][color=green]
> > server stop processing the ASP code as soon as it encounters the[/color][/color]
Redirect[color=blue][color=green]
> > command? Or does it ever continue to process the page?
> >
> > Basically, with the following code:
> >
> > [....]
> > Response.Redirect("../newpage.asp")
> > Response.Write "This will crash: " & 1/0
> >
> > It seems that the server sends the redirection header to the client as[/color]
> soon[color=green]
> > as it hits the .Redirect line, and stops processing that page. I do not
> > receive a divide by zero error.
> >
> > Is this always the expected behavior?
> >
> > Also, someone mentioned in a previous thread that the correct syntax to[/color]
> use[color=green]
> > is
> >
> > Response.Redirect "http://someurl.com"
> > Response.End
> >
> > What would happen if someone omitted to send a Response.End command?
> >
> > Thanks in advance.
> >
> > JC
> >
> >[/color]
>
>[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles