468,505 Members | 1,756 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Response.redirect not working

In the code below, I am trying to go from one asp page to another:

For Each tripToAccept As String In tripsToAccept.Split("/"c)
dataManager.UpdateTripDetail("Accept", CInt(tripToAccept),
Hiduser.Value)
Next
Response.Redirect("TripAcceptReject.aspx", False)
I am not getting an error, but I'm also not seeing anything happen at
all. This is an existing app and it looks like the page I'm trying to
open up is a modal page, could that be an issue. Is there another way
to open up one asp page from another?

Jun 21 '07 #1
5 10935
On Jun 21, 8:55 am, Doug <dnlwh...@dtgnet.comwrote:
In the code below, I am trying to go from one asp page to another:

For Each tripToAccept As String In tripsToAccept.Split("/"c)
dataManager.UpdateTripDetail("Accept", CInt(tripToAccept),
Hiduser.Value)
Next

Response.Redirect("TripAcceptReject.aspx", False)

I am not getting an error, but I'm also not seeing anything happen at
all. This is an existing app and it looks like the page I'm trying to
open up is a modal page, could that be an issue. Is there another way
to open up one asp page from another?
Is the previous code getting excuted or is the redirect not working?
You can try Server.transfer(urllocation)

Jun 21 '07 #2
Doug wrote:
In the code below, I am trying to go from one asp page to another:

For Each tripToAccept As String In tripsToAccept.Split("/"c)
dataManager.UpdateTripDetail("Accept", CInt(tripToAccept),
Hiduser.Value)
Next
Response.Redirect("TripAcceptReject.aspx", False)
I am not getting an error, but I'm also not seeing anything happen at
all. This is an existing app and it looks like the page I'm trying to
open up is a modal page, could that be an issue. Is there another way
to open up one asp page from another?
As you are setting the second parameter to false, the execution
continues in the code. Obviously you are doing something else later on
in the code that prevents the redirection.

If you want the execution of the current code to end after the Redirect
statement, specify true as the second parameter, or use the overload
without a second parameter:

Response.Redirect("TripAcceptReject.aspx")

--
Göran Andersson
_____
http://www.guffa.com
Jun 22 '07 #3
As you are setting the second parameter to false, the execution
continues in the code. Obviously you are doing something else later on
in the code that prevents the redirection.
I'm not doing anything later on. There's no more code after this.
It should go directly to the TripAcceptReject page, but it doesn't.
>
If you want the execution of the current code to end after the Redirect
statement, specify true as the second parameter, or use the overload
without a second parameter:
I tried that, but I kept getting a threading error. Per a previous
post, someone told me to use false for that parameter to avoid the
error and then this is what happens.

I did try using Server.Transfer and that appears to work but after it
executes the code in the redirected page, it jumps back to the calling
page, throws that Threading exception, but still displays the
TripAcceptReject page, but within the same window. I want it to
display as a seperate window (I believe it currently is doing this as
a modal window, but the way it was called before is through
Javascript, I'm now in server side code (VB) and need to do it there.
I can't believe that it is that hard to do a simple redirect to a
window!!!! :))

Jun 23 '07 #4
Doug wrote:
>As you are setting the second parameter to false, the execution
continues in the code. Obviously you are doing something else later on
in the code that prevents the redirection.

I'm not doing anything later on. There's no more code after this.
It should go directly to the TripAcceptReject page, but it doesn't.
There doesn't have to be any code that you have written after that to
interfer with the process. The page creation process continues,
rendering the controls that you have in the page into an html page that
is sent to the browser.

If you don't want that to happen, you have to make sure that there are
no controls in the page so that the rendering doesn't produce any
output. Then it might work.
>If you want the execution of the current code to end after the Redirect
statement, specify true as the second parameter, or use the overload
without a second parameter:

I tried that, but I kept getting a threading error. Per a previous
post, someone told me to use false for that parameter to avoid the
error and then this is what happens.
The Response.Redirect method uses an exception to end the execution of
the current page. This is normal, and if you want it to work normally,
you should not catch this exception.

Using the second parameter does prevent the exception to be thrown, but
if you want to do it that way, you have to deal with the rest of the
page creation process.
I did try using Server.Transfer and that appears to work but after it
executes the code in the redirected page, it jumps back to the calling
page, throws that Threading exception, but still displays the
TripAcceptReject page, but within the same window.
It's not jumping back to the page. It's rendering the page because the
first page added it's controls to the page tree, and the second page
also added it's controls to the page tree, and is rendering all of it
into a single html page.
I want it to
display as a seperate window (I believe it currently is doing this as
a modal window, but the way it was called before is through
Javascript, I'm now in server side code (VB) and need to do it there.
I can't believe that it is that hard to do a simple redirect to a
window!!!! :))
If you want to display it as a separate window, you can't use server
code to accomplish it. A new window can only be opened from the browser,
so you have to either use a link with target="_blank" or the window.open
method in Javascript.

--
Göran Andersson
_____
http://www.guffa.com
Jun 24 '07 #5
If you want to display it as a separate window, you can't use server
code to accomplish it. A new window can only be opened from the browser,
so you have to either use a link with target="_blank" or the window.open
method in Javascript.
I am not sure how to go from being in server code to calling
Javascript code. Do you have some suggestions for where to look to
learn how to do this?

Jun 24 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Justin | last post: by
5 posts views Thread by john | last post: by
1 post views Thread by Sospeter | last post: by
10 posts views Thread by Niggy | last post: by
3 posts views Thread by Marc Hoeijmans | last post: by
5 posts views Thread by ODAN | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.