473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET 2.0 -- Page_Load called multiple times

I am working on a web site and whenever someone arrives at the home
page, I'm trying to track this by inserting some values into my
database.

I do so from the Page_Load function. Unfortunately for some reason,
for each person entering my website, I get 3 entries in my database!
I've been reading everywhere to figure out why this could be happening,

but I'm out of ideas.
1) I've made sure that Page.IsPostBack is set to false. No
improvement.
2) I also set AutoEventWireup to false, but then my Page_Load function
wouldn't called at all, so now I've set it back to being true...
Any ideas or suggestions would be appreciated.
Thanks in advance,
Amit

Apr 1 '06 #1
4 2149
DWS
amitku,
I use the server log because it involves much less coding. Sorry I don't
know why your getting three hits.

Good Luck
DWS
"am****@gmail.c om" wrote:
I am working on a web site and whenever someone arrives at the home
page, I'm trying to track this by inserting some values into my
database.

I do so from the Page_Load function. Unfortunately for some reason,
for each person entering my website, I get 3 entries in my database!
I've been reading everywhere to figure out why this could be happening,

but I'm out of ideas.
1) I've made sure that Page.IsPostBack is set to false. No
improvement.
2) I also set AutoEventWireup to false, but then my Page_Load function
wouldn't called at all, so now I've set it back to being true...
Any ideas or suggestions would be appreciated.
Thanks in advance,
Amit

Apr 1 '06 #2
I'm doing some additional tracking...the website has a asp parameter
that I use to track certain other variables, so I can't use the server
log.

Anybody out there with any ideas why Page_Load can be called multiple
times?

Thanks in advance,
Amit

Apr 3 '06 #3
It turns out Google Adsense is the reason for the extra calls to
Page_Load. Removing the adsense code made everything work dandy. But
this makes no sense to me....does anybody know why this is the case,
and if so, how can I get around this (besides removing the adsense
permanently)?

Thanks in advance,
Amit

Apr 3 '06 #4
use a session variable to detect if you are running the same again

<am****@gmail.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
I am working on a web site and whenever someone arrives at the home
page, I'm trying to track this by inserting some values into my
database.

I do so from the Page_Load function. Unfortunately for some reason,
for each person entering my website, I get 3 entries in my database!
I've been reading everywhere to figure out why this could be happening,

but I'm out of ideas.
1) I've made sure that Page.IsPostBack is set to false. No
improvement.
2) I also set AutoEventWireup to false, but then my Page_Load function
wouldn't called at all, so now I've set it back to being true...
Any ideas or suggestions would be appreciated.
Thanks in advance,
Amit

Apr 4 '06 #5

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

Similar topics

3
2104
by: George Ter-Saakov | last post by:
I just find out in a debug that Page_Load is called 12 times when rendering the page. What could be the problem? All this page has is a bunch of UserConrols. I did check the InitalizeComponent. It hooked up only once there and AutoEventWireup="false"
2
4429
by: magister | last post by:
Hello I have a default.aspx page with which has an iframe. In the code-behind of the default.aspx page it loads the 'src' attribute of the iframe. The iframe loads another aspx page, but when it loads the Page_Load method is called multiple times. In some situations the page is called twice and in others it is called 4 times.
14
13113
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) { //existing session? if (Session == null) { //save local empty order object this._newOrder = Orders.Initialize();
5
1715
by: Olav Tollefsen | last post by:
I would like some common code to be executed before Page_Load is called for every Web Form page. The code should do some logging. Where can I put common code like this? I would like to avoid having to manually insert the code on every page in my application. Olav
6
2399
by: Olivier Matrot | last post by:
Hello, This has probably been asked several times, but It must be clarified for me. I would like to know why sometimes during a postback Page_Load is called after the function marked for postback. Here's the deal : From now on, I set CurrentThread.CurrentCulture only during PageLoad. so date and currency format is incorrect if page load is not called first. What should I do to ensure that CurrentThread.CurrentCulture is alway set...
5
3164
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits CommonPageBase - Contains myPage which inherits PageBase Each of these classes overrides OnInit and ties an event handler
0
1603
by: Jonathan Duke | last post by:
I have written a custom session state provider that stores session data in XML in a SQL database , and I was running the SQL profiler to verify that all of my stored procedures were called in the correct situations. Each time I visited certain pages, I noticed that the SP called by the ResetItemTimeout method was called multiple times in a row. I have tracked this problem down to the point of the WebResource.axd module. It appears that...
3
1668
by: gellis99 | last post by:
I've searched several discussions on this topic and haven't been able to resolve my issue. I have a function I call within the page_load event of a page. This function makes a call to the database to retrieve data. While I was doing performance review of the site, my sql profiler showed that query being executed multiple times for a single page load. I'm using several web user controls on the pages, none of which call this function. ...
4
2860
by: David C | last post by:
I spent the last four hours trying to figure out why Page_Load would execute twice. Even stranger was that everything within if (! IsPostBack){....} executed twice as well. There is no rhyme or reason for that. Here is what I found out. When you have an ImageButton with no ImageURL set, it will always do that. This was not the case with .NET 1.0. So if you need to experiment with ImageButton, set something to the ImageUrl
0
9479
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
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...
0
9942
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...
1
7492
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
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
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
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
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
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.