Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2011, 03:48 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
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")
 
Old March 3rd, 2011, 05:55 AM
Authorized User
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi,

while you can probably reach master pages outside of the virtual directory with "../MasterPage.master" by setting the AspEnableParentPaths metabase property to true (or creating a child virtual directory that points to your root), it is not really recommended.
I'm afraid that if you go down the path of a virtual directory it's best to duplicate your master pages.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Master Page in ASp.net 2.0 dilipv .NET Framework 2.0 1 March 4th, 2008 07:00 AM
ASP.NET and Master Page ayazhoda ASP.NET 2.0 Basics 5 May 14th, 2007 04:22 PM
JScripts on ASP.NET Master page? woojtii Javascript How-To 0 March 28th, 2007 05:54 AM
Problem regarding the making of virtual directory CsharpHelp C# 0 October 27th, 2005 01:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.