ASP.net - The virtual path '/Master.master' maps to another application, which is not allowed

derp_in_mouth picture derp_in_mouth · Sep 4, 2012 · Viewed 9.6k times · Source

I have an asp.net master page located in the root directory of my site. I have a page in the directory "/myfolder" from the master page:

 <%@ Page Title="" Language="C#" MasterPageFile="../Master.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myproject.TimelapseDefault" %>
 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <p>

The files look like:

/Master.master /myfolder/default.aspx

Why do I get this error, when I upload it to my (non dedicated godaddy iis 7) server, but it works on localhost?: 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 '/timelapserpro/Master.master' does not exist.

Source Error:

Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myproject.TimelapseDefault" %>

Line 2: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
Line 3: <p>

All pages are in the same solution.

Answer

angularrocks.com picture angularrocks.com · Sep 4, 2012

try to change MasterPageFile="../Master.master" to MasterPageFile="~/Master.master"

Also check if you create virtual folder on your iis 7 properly. Check if path to your app is correct. You have to have such folder structure in your IIS

->YourAppName (the root of your app contains your root files)
  ->myfolder (contains your myfolder content)