Asp.Net 2.0 Web Application Project Inherited Base class?

G

gabe

Hi,

Is it possible using Web Application Projects with Asp.Net 2.0 Sp1 to
have a partial class code behind inherit from a base class that could
be used for all the pages on a web site?

The site uses a Master page, but there are some tasks I'd prefer to be
done elsewhere. For example there a couple of common controls in the
Master Page that may be used differently by some of the pages. And I'd
like to have common code that can call a service layer for things like
logging user actions to a db without have to repeat it in every page.

Thanks in advance,

Gabe
 
M

Mark Rae

Is it possible using Web Application Projects with Asp.Net 2.0 Sp1 to
have a partial class code behind inherit from a base class that could
be used for all the pages on a web site?

Yes absolutely! I do this all the time.

Just create your base class and then change the partial class declaration to
ineherit from it instead of System.Web.UI.Page
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top