Results 1 to 4 of 4

Thread: ASP.NET Master Page Problem with Virtual Directory Alias

  1. #1
    Join Date
    May 2003

    Question ASP.NET Master Page Problem with Virtual Directory Alias

    To make it easier for users to get to a section of our site, we created a virtual directory alias which redirects the user to a specific web page. If there's no virtual directory for http://www.mysite.com/subdirectory/webpage.aspx, then that Master Page reference works fine. But once I created a virtual directory and attempted to get to that same page by typing the path to the virtual directory (http://www.mysite.com/subdirectory), I received this error message relating to the web page trying to access our site's Master Page, which is located in the root of the site:

    Server Error in '/subdirectory' Application.
    Parser Error
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: The file '/subdirectory/MasterPage.master' does not exist.

    Source Error:

    Line 1: <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" EnableSessionState="true" EnableViewState="false" Title="Web Page" %>

    Source File: /subdirectory/webpage.aspx Line: 1

    I've tried changing the "~/MasterPage.master" reference to "./MasterPage.master" (one period), "../MasterPage.master" (two periods), "/MasterPage.master" (no tilde before slash), and "MasterPage.master" (just the file name) to no avail! Does anyone here know how I can fix this?

    These are two sites that contain steps on what we did:
    http://www.microsoft.com/technet/pro....mspx?mfr=true (under "Virtual Directories")
    http://www.beansoftware.com/ASP.NET-...S-ASP.NET.aspx (under "How to create the virtual directory on the web server")
    It's the end of the world as we know it...and I feel fine

  2. #2
    Join Date
    Jan 2003
    Dundee, Scotland
    Hi kwilliams,

    Have you tried attching your master page at the application level? You can defind the master page in your web.config file:

    <pages masterPageFile="MySite.Master" />
    This would specify that all ASP.NET pages in the application bind to your master page.

    source of code: http://msdn.microsoft.com/en-us/libr...80).aspx#Y1094



  3. #3
    Join Date
    May 2003
    Thanks for the reply Ribeyed.

    I tried your suggestion, and received the following error message:
    The relative virtual path 'MasterPage.master' is not allowed here.

    So then I changed "MasterPage.master" to ~/MasterPage.master", and received the same error as my first post:
    The file '~/MasterPage.master' does not exist.

    I also tried creating a web.config file within the virtual directory with this data, and received the exact same errors.

    The good thing is that the virtual directory is not being attached to the Master Page's path as before, but it's still not finding it.

    Do you have any other suggestions?
    It's the end of the world as we know it...and I feel fine

  4. #4
    Join Date
    Jun 2012

    ASP.NET Master Page Problem with Virtual Directory Alias

    Hi kwilliams,

    Have you resolved this issue yet?
    I am facing a same problem now.

    Please let me know.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center