473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Response.Redirect triggers Page_Load

I am having an issue when I trigger a Response.Redirect, the Page_Load
fires on the page where the Response.Redirect was called. From what
I've read, this should not happen and the browser should be sent to
page that was passed in teh Response.Redirect page. The
AutoEventWireup is set to false on all pages. Any help would be
greatly appreciated.

Mar 15 '06 #1
6 3837
Thus wrote dw*****@gmail.com,
I am having an issue when I trigger a Response.Redirect, the Page_Load
fires on the page where the Response.Redirect was called. From what
I've read, this should not happen and the browser should be sent to
page that was passed in teh Response.Redirect page. The
AutoEventWireup is set to false on all pages. Any help would be
greatly appreciated.


Just to clarify... the page, on which you call Response.Redirect() is loaded
*again*?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 15 '06 #2
Yes it is. I can tell this because I put a
System.Diagnostics.Trace.WriteLine(IsPostBack); in the Page_Load body
and whenever the Response.Redirect is called, I receive a True in my
output window and then the next page will load.

Mar 15 '06 #3
<dw*****@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I am having an issue when I trigger a Response.Redirect, the Page_Load
fires on the page where the Response.Redirect was called. From what
I've read, this should not happen and the browser should be sent to
page that was passed in teh Response.Redirect page. The
AutoEventWireup is set to false on all pages. Any help would be
greatly appreciated.


Let's assume for a second that you've got an <asp:Button> control on a page
with some code behind which includes the Response.Redirect code.

1) Page loads first time - Postback is false - Page_Load fires

2) User clicks the button - page posts back - Postback is true - Page_Load
fires - code behind button executes and does the Response.Redirect

You can't stop the Page_Load event from firing - all you can do is wrap its
contents in a if(Page.IsPostback) {}

The Page_Load event will always fire regardless of what the rest of the code
on that page subsequently does...
Mar 15 '06 #4
Thank you for your explanation, however in my Page_Load section I am
dynamically adding buttons from a query I execute on my database. The
problem is, I do not always get the same button or in the same order (a
feature I want), so when they repopulate, if a new button is in the
place of the old button, I get redirected to the new button destination.

Mar 15 '06 #5
Thus wrote dw*****@gmail.com,
Yes it is. I can tell this because I put a
System.Diagnostics.Trace.WriteLine(IsPostBack); in the Page_Load body
and whenever the Response.Redirect is called, I receive a True in my
output window and then the next page will load.


Can you post your code?

--
Joerg Jooss
ne********@joergjooss.de
Mar 15 '06 #6
<dw*****@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Thank you for your explanation, however in my Page_Load section I am
dynamically adding buttons from a query I execute on my database. The
problem is, I do not always get the same button or in the same order (a
feature I want), so when they repopulate, if a new button is in the
place of the old button, I get redirected to the new button destination.


Wow! I'd strongly suggest you rethink your page structure...

If you must create buttons dynamically at run time, do it in Page_Init, not
Page_Load...
Mar 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
7
by: Anne | last post by:
hie there, i want to be able to pass multiple parameters to another page. currently, i am able to do so, but somehow i feel it is not the correct way to do it. below is part of what i have so far....
1
by: VB Programmer | last post by:
I have a default.aspx page that simply does this (in the "Try" block): Response.Redirect("MyStartPage.aspx") I keep getting this exception on this line: "System.Threading.ThreadAbortException:...
4
by: Marty U. | last post by:
I have a Session variable I need to check the value of. If it is value a then redirect to some page. I need to implement this in a user control that is on all the relevent pages. I placed the if...
3
by: michael_vanommeren | last post by:
I have two web applications that I am working with and I am trying to do a Response.Redirect from one to the other. They are setup as separate web applications on the same IIS server. If I go...
1
by: MikeM | last post by:
We are getting a behavior on a Response.Redirect("SomeUrl", True) that I'm hoping someone can explain. This all refers to the code snip at the end. By the way, this is all VB ASP.NET v1.0 code. ...
0
by: Clas | last post by:
Hello! I have written a javascript which posts back a page with __doPostBack if a user presses the escape-button on the keyboard. Then in Page_Load I´m doing a response.redirect to another page....
2
by: Mark Rae | last post by:
Hi, I have a fairly simple site, the vast majority of which is available to everyone on the public internet. However, the site has one section which requires logon via the standard...
3
by: Mark Huebner | last post by:
I have an aspx web page with the following C# code in the page load event. Can somebody tell me if the Response.Redirect() will cause my tLoadDNN thread to stop executing before it is finished? ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.