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.Inf ormational,"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?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)
--
Milosz
"Joey" wrote:
Quote:
Originally Posted by
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.Inf ormational,"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?
>
>
On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
wrote:
Quote:
Originally Posted by
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)
>
--
Milosz
>
>
>
"Joey" wrote:
Quote:
Originally Posted by
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...
>
Quote:
Originally Posted by
protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}
>
Quote:
Originally Posted by
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.
>
Quote:
Originally Posted by
Does anyone know what causes this? How can I fix it?- Hide quoted text -
>
- Show quoted text -
My code does not explicitly assign any event handlers.
Hi again Joey,
I hope you are well. Could you please paste both aspx page and code beside
so we could have a look?
--
Milosz
"Joey" wrote:
Quote:
Originally Posted by
On Jun 27, 5:38 pm, Milosz Skalecki [MCAD] <mily...@.DONTLIKESPAMwp.pl>
wrote:
Quote:
Originally Posted by
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)
--
Milosz
"Joey" wrote:
Quote:
Originally Posted by
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...
Quote:
Originally Posted by
protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
Event.Write(EventSource.UserActivity,EventType.Inf ormational,"My
event text");
Counter.Hit(WebPage.MyPage);
}
}
Quote:
Originally Posted by
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.
Quote:
Originally Posted by
Does anyone know what causes this? How can I fix it?- Hide quoted text -
- Show quoted text -
>
My code does not explicitly assign any event handlers.
>
>
0 comments:
Post a Comment