Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Master Pages

Status
Not open for further replies.

governmentworker

Programmer
May 5, 2011
3
CA
I am working in asp.net 2005. I have a giant web application that contains all the styles and master pages, plus several web apps. We need to create many more web apps that have the same look and feel. What I want to do is divide the application up into one solution with many projects. One project, the "parent", would contain all of the formatting things (style sheets, masterpages, anything common to all apps) then create many "child" projects that would reference the parent's dll file. That way we don't have to recompile everything every time we make a change. This is going to be very large and needs to be modular.
Here's the problem; every thing I read on the internet says that it's possible, yet I can't find a working solution. I've done this sort of thing for windows apps, but never with a master page. I can reference the classes, but not the masterpage (so far).
When it comes time to reference the Parent master page in the child code, it keeps telling me it can't find the file. I have all of my code, for all of the apps, saved within the same parent directory.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Child2.aspx.vb" Inherits="ASP.masterpagebase_master" MasterPageFile="/1Column.master"%> 1column.master cannot be found....
Any ideas?


 
solutions and projects are just logical containers inside of VS. they are not required to compile or deploy the website. if you want a 1:1 mapping between development and production then you may be better off keeping all the web UI in a single project and use directories to logically separate the modules.

what you want is possible, but it works against the defaults of VS so you won't get a 1:1 development:production experience. for example: you can any path for the master page. during development it may say the file doesn't exist. as long as the master page file is present when the site is compiled & deployed it will work. this will require customization of the build process, but it is possible.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks for the reply Jason.

I am quite sure that for a web application, the projects must be recompiled to be deployed. Not the HTML/website parts, but the application (aspx) parts.

Perhaps I didn't explain my problem very clearly... One giant application is not an option, it must be modular. Preferably consisting of one piece (be it a dll, something on the server, who knows) having all the master pages, styles, headers, footers, etc. Then each other piece accessing those styles (and that can be done as an include, reference, something on the server, whatever).

I want to create a asp.Net web application solution with 1 parent project (having all the styles, etc) and many child projects (one for each app). But when I do this, I cannot access the parent masterpage files from the child projects. Can anyone fill me in on the details of how to do this? The more explicit the better. Any info on the virtual directory stuff in regards to this would be a bonus too.

Thanks!
 
I am quite sure that for a web application, the projects must be recompiled to be deployed. Not the HTML/website parts, but the application (aspx) parts.
yes, the code must be recompiled. aspx (and the like) are server based template files, if the template changes, they must be deployed. also deploying a project in whole, rather piece meal makes maintenance that much easier and introduces fewer bugs.

Perhaps I didn't explain my problem very clearly... One giant application is not an option, it must be modular.
no, I understood :) modular != many projects nor does many project = modular. that's just 1 option. there may be business/procedural restrictions that require 1 project per module, but multiple projects are not required for modularity.

no matter how you setup your VS projects what matters in the final, deployable files (css, js, images, as?x & dll). the master file(s) must exist in the directory specified in the web.config or page for formatting to work.

if you want the local development experience to be the exact setup of production then, you will need to customize the build process to move and copy files around so when you press F5 to run/debug the UI elements and master file/binary is present.

there is a very crude editor within VS that allows you to tap into pre/post build events. however you maybe better off using a text editor, or a different build tool to make this happen.

the details of how this will be done are specific to your project.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top