MasterPage override problem with Module based site and IIS Virtual Directories

Last post 02-20-2008 8:17 AM by happyfirst. 1 replies.

Sort Posts:

  • MasterPage override problem with Module based site and IIS Virtual Directories

    02-13-2008, 7:57 PM
    • Member
      18 point Member
    • happyfirst
    • Member since 01-24-2008, 3:04 PM
    • Posts 63

    I thought I had everything working great till I removed an override template file.

    I have a website that is made of up modules (class library dlls). I use IIS Virtual Directories so that everything is compilable and debugable from one solution file. The root project is basically empty. I'm trying to build the whole core site in the various modules so that I can then allow for easy overrides by dropping them into the core website project. I have a MasterPage and a ContentPage in the main module. At design time, VS 2008 works great and it finds the master page from the virtual directory based module project and I can edit the content page. But it won't run unless I create a copy of that master page in the root directory (basically the same path minus the initial module directory). At runtime, it's resolving MasterPageFile="~/_Templates/Pages/Main.Master" which goes to the root directory. I can't change the design time version to be MasterPageFile="~/AppCore/_Templates/Pages/Main.Master" because at design time, VS 2008 is already resolving ~ to /AppCore which then doubles it up and it won't find it. In any event, I don't even want it to resolve this setting because my BasePage class is going to override the MasterPageFile setting anyways. But it won't get that far since it complains that it can't find the initially set master page file.

    So basically

    1) There's different behaviour in VS2008 for the ~ for multi-project module based webprojects that use IIS virtual directories between designtime and runtime. Is this a bug?

    2) While I see that one can dynamically change the MasterPageFile, it seems they still need to ensure that the MasterPageFile that the content page @page directive references is still available even though you don't want to use it.  Is there anyway to override this? In my case I need to ensure it's available in the 'wrong' directory because of how VS treats the ~.  It seems like the aspnet engine is checking for the existence of the MasterPageFile setting in the @page directive before the class that page inherints from PreInit fires. I think this is also a bug. Shouldn't it wait to check for the existence of that MasterPageFile until AFTER PreInit so that users can change the MasterPageFile setting and not have to worry about keeping the other file around.

    Right now my only option is to remove the MasterPageFile setting from the content page and I loose ALL visual editting. Such a shame because the class checks for the existence of the master file to early.

  • Re: MasterPage override problem with Module based site and IIS Virtual Directories

    02-20-2008, 8:17 AM
    • Member
      18 point Member
    • happyfirst
    • Member since 01-24-2008, 3:04 PM
    • Posts 63

    Has anybody gotten the override application root URL feature in the web application project web settings to work? I'm trying to override the root url for my nested web application project module (that is NOT an IIS application). I set this and then I fixed up the pages in that module to now reference their module template by adding in the subdirectory to the module (since I reset the root url back up one level). But I still can't open the page in design mode. That editor within VS locks up and when I click the bottom design button. And then there are errors below about it not being able to reference a path but then the paths it shows are all the right valid ones.

Page 1 of 1 (2 items)