473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Redire ct triggers Page_Load

I am having an issue when I trigger a Response.Redire ct, the Page_Load
fires on the page where the Response.Redire ct 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.Redire ct page. The
AutoEventWireup is set to false on all pages. Any help would be
greatly appreciated.

Mar 15 '06 #1
6 3854
Thus wrote dw*****@gmail.c om,
I am having an issue when I trigger a Response.Redire ct, the Page_Load
fires on the page where the Response.Redire ct 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.Redire ct 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.Redire ct() is loaded
*again*?

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Mar 15 '06 #2
Yes it is. I can tell this because I put a
System.Diagnost ics.Trace.Write Line(IsPostBack ); in the Page_Load body
and whenever the Response.Redire ct 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.goo glegroups.com.. .
I am having an issue when I trigger a Response.Redire ct, the Page_Load
fires on the page where the Response.Redire ct 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.Redire ct 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.Redire ct 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.Redire ct

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

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.c om,
Yes it is. I can tell this because I put a
System.Diagnost ics.Trace.Write Line(IsPostBack ); in the Page_Load body
and whenever the Response.Redire ct 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********@joer gjooss.de
Mar 15 '06 #6
<dw*****@gmail. com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.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
2161
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 datagrid. I am using the viewstate object to store the Arraylist items on the page on postback. My PROBLEM is that I need to redirect the user to a new aspx page and on this new page i need to be able to access the items in my arraylist. Is this...
7
43255
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. 'first page Private Sub btnOK_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click Response.Redirect("InputValues.aspx?Requestor=" &
1
2385
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: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End() at System.Web.HttpResponse.Redirect(String url, Boolean endResponse) at...
4
5376
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 and redirect statement within the page_load of the user control. However, when you try to access any page that has the user control it simply loads for minutes and never actually redirects. What am I missing with executing the response.redirect...
3
3473
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 directly to the second application in a browser, all of my events fire correctly. However, if I have the first application do a Response.Redirect to the second, for some reason none of my events on the second application ever get fired. After I...
1
2734
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. So we have the Page_Load event of an ASPX page fire which in the snip you see calls "SomeMethod". Also you see in Page_Load two Catch statements. The first is "SpecialException". We created our own extended exception (inherits from...
0
1384
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. This scripts only works for me if the page (which had the page_load with the response.redirect) is in a frameset environment. If the page is not in frameset, then the postback works fine but nothing happens when doing response.redirect.
2
1378
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 username-password combination. The usernames and passwords are stored in encrypted form in SQL Server 2000. To prevent people trying to access the pages in the secure section, I used
3
3049
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? tLoadDNN might occasionally take up to 16 seconds to complete. protected void Page_Load(object sender, EventArgs e) { Thread tLoadDNN = new Thread(new ThreadStart(LoadDNN)); tLoadDNN.Start(); Response.Redirect("Default1.htm");
0
7965
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8271
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2399
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.