|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to obtain a reference to derived class from base?I'm trying to centralize some initialization routines in my web application
by placing logic into a 'base form' that all web pages inherit from. In the class for the base form, I would like to be able to reference in some event (Pre_load, perhaps), the inheriting class without having to explicitly pass this up as a property set. Is there an easy way to do this? More specifically, I'm using log4net and I want to have separate loggers for each page where the %logger property shows as 'webForm1.aspx' instead of 'basePage.aspx' for each log entry. >More specifically, I'm using log4net and I want to have separate loggers for this.GetType() will return type info for the actual type of the>each page where the %logger property shows as 'webForm1.aspx' instead of >'basePage.aspx' for each log entry. current page object. Request.FilePath returns the file path of the page being requested if that's what you're looking for. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Perfect!
(Me.GetType for the vb folks out there) Thanks, Mattias. Show quote "Mattias Sjögren" wrote: > > >More specifically, I'm using log4net and I want to have separate loggers for > >each page where the %logger property shows as 'webForm1.aspx' instead of > >'basePage.aspx' for each log entry. > > this.GetType() will return type info for the actual type of the > current page object. > > Request.FilePath returns the file path of the page being requested if > that's what you're looking for. > > > Mattias > > -- > Mattias Sjögren [C# MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. > |
|||||||||||||||||||||||