A solution with multiple web projects and ASPX page reusability




Is there any way to break a web application into separated web projects, so
we can re-use pages\?

I am trying to put aspx pages and/or ascx pages in separated web projects,
but when we run the solution, the start-up web project contain all necessary
aspx/ascx pages + dlls to run.

Any help would be appreciated,


Tim Mackey

hi max
the easiest step is to place the code behind files in a class library
project and compile them. then you can refer to the full namespace of the
code behind class in the Inherits attribute in your ASPX page declaration.
this way you at least get to re-use the codebehind, although you would still
have to deploy the ASPX file itself. there is also a way of compiling ascx
pages into a binary, http://msdn2.microsoft.com/en-us/library/aa479318.aspx

hope this helps

Steven Cheng[MSFT]

Thanks for Tim's input!

Hi Max,

Yes, as Tim suggested, for web application, you can easily reuse the codes
via define common classes or base classes and separate them into a class

However, for aspx page or other page stuffs, it is not quite convenient and
practical to separate them into separate projects because diffrent project
may result to different Application context(such as appdomain, cache,
sessionstate boundary...) and it will be much difficult for you develop the
pages' code and coordinate them.


Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

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