|
 |
aspx thread: Best approach for page logging?
Message #1 by "Brooks Talley" <brooks@f...> on Mon, 9 Sep 2002 21:58:11
|
|
Hi there. I'm just making the move to asp.net; I currently manage a
150,000-line classic ASP application.
I'm trying to figure out how to go about making every aspx page perform a
logging call. In my classic ASP application, I've got a simple Sub
called LogPage that lives in an include file that every page uses. At
the end of every ASP page, after sending </body></html>, there's a simple
call along the lines of LogPage "pagename".
I've got a user control at the footer of each page in my newborn aspx
application; should I be adding a parameter to it so each page calling
the footer passes the name to log? I'm still trying to get my ahead
around the paradigm differences in aspx, and I definitely want to do this
the right way (or at least *a* right way)... but I'm just having a hard
time grasping an appropriate way to do this.
Thanks
-Brooks
Message #2 by "Oliver, Wells" <WOliver@l...> on Mon, 9 Sep 2002 13:54:33 -0700
|
|
I would suggest building a page class for your ASP.NET application to
inherit. In its Page_Load event you can call your logging function.
That way, any page that inherits the class will have that page_load event.
-----Original Message-----
From: Brooks Talley [mailto:brooks@f...]
Sent: Monday, September 09, 2002 2:58 PM
To: ASP+
Subject: [aspx] Best approach for page logging?
Hi there. I'm just making the move to asp.net; I currently manage a
150,000-line classic ASP application.
I'm trying to figure out how to go about making every aspx page perform a
logging call. In my classic ASP application, I've got a simple Sub
called LogPage that lives in an include file that every page uses. At
the end of every ASP page, after sending </body></html>, there's a simple
call along the lines of LogPage "pagename".
I've got a user control at the footer of each page in my newborn aspx
application; should I be adding a parameter to it so each page calling
the footer passes the name to log? I'm still trying to get my ahead
around the paradigm differences in aspx, and I definitely want to do this
the right way (or at least *a* right way)... but I'm just having a hard
time grasping an appropriate way to do this.
Thanks
-Brooks
Message #3 by "Brooks Talley" <brooks@f...> on Mon, 9 Sep 2002 22:31:00
|
|
> I would suggest building a page class for your ASP.NET application to
inherit. In its Page_Load event you can call your logging function.
>That way, any page that inherits the class will have that page_load
event.
Thanks for the speedy reply!
I already have a page class that's inherited throughout that app, so that
part works fine. However, there are times when the page name isn't known
at the beginning of page rendering; for instance, login.aspx should be
able to log "login: success" or "login: failed" as its event names.
Likewise, other pages that perform multiple functions need to be able to
log which function was actually called.
I accomplish this in classic ASP by defining a global variable and
letting each page set it as need be, then the logging page at the end of
HTML rendering just uses that variable.
Another concern -- wouldn't logging in the page class be a performance
issue, as it would be hit before the user got their page rendered?
Thanks!
-Brooks
Message #4 by "Dave Buckner" <Dave@N...> on Tue, 10 Sep 2002 12:51:09 -0500
|
|
Wrap the Logging into a class, then add a module level variable in your
inherited class. That should work. That way in function calls you can
still talk to it.
Regards,
Dave
-----Original Message-----
From: Brooks Talley [mailto:brooks@f...]
Sent: Monday, September 09, 2002 10:31 PM
To: ASP+
Subject: [aspx] RE: Best approach for page logging?
> I would suggest building a page class for your ASP.NET application to
inherit. In its Page_Load event you can call your logging function.
>That way, any page that inherits the class will have that page_load
event.
Thanks for the speedy reply!
I already have a page class that's inherited throughout that app, so
that
part works fine. However, there are times when the page name isn't
known
at the beginning of page rendering; for instance, login.aspx should be
able to log "login: success" or "login: failed" as its event names.
Likewise, other pages that perform multiple functions need to be able to
log which function was actually called.
I accomplish this in classic ASP by defining a global variable and
letting each page set it as need be, then the logging page at the end of
HTML rendering just uses that variable.
Another concern -- wouldn't logging in the page class be a performance
issue, as it would be hit before the user got their page rendered?
Thanks!
-Brooks
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
|
|
 |