Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Strange Behavior for Pages Named Default.aspx

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joey - 27 Jun 2007 16:51 GMT
I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
I like to create and track page view events, increment counters, etc.
I do this in a block on each page, like this...

protected void Page_Load(object sender, EventArgs e)
{
  if(!this.Page.IsPostBack)
  {
     Event.Write(EventSource.UserActivity,EventType.Informational,"My
event text");
     Counter.Hit(WebPage.MyPage);
  }
}

Now, for the problem. I noticed that many events are being written
twice, and many counters are being incremented twice when viewing the
page only once. When I set a breakpoint inside the code block above,
for any page named "Default.aspx" (no matter where it is in the folder
structure) the lines inside the code block execute twice. If I rename
the page to something else, they execute only once, as expected.

Does anyone know what causes this? How can I fix it?
Milosz Skalecki [MCAD] - 27 Jun 2007 23:38 GMT
Hi Joey,

Seems page events are fired twice because event handler is assigned two
times - by the AutoWireupEvent directive and by your code by adding the
handler explicitely (vb.net AddHandler or Handles clauses)

Signature

Milosz

> I have several asp.net 2.0 apps written in VS2005 in C#. For each one,
> I like to create and track page view events, increment counters, etc.
[quoted text clipped - 18 lines]
>
> Does anyone know what causes this? How can I fix it?
Joey - 27 Jun 2007 23:58 GMT
On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
wrote:
> Hi Joey,
>
[quoted text clipped - 29 lines]
>
> - Show quoted text -

My code does not explicitly assign any event handlers.
Milosz Skalecki [MCAD] - 28 Jun 2007 09:28 GMT
Hi again Joey,

I hope you are well. Could you please paste both aspx page and code beside
so we could have a look?
Signature

Milosz

> On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
> wrote:
[quoted text clipped - 33 lines]
>
> My code does not explicitly assign any event handlers.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.