Search code examples
c#asp.netvisual-studio-2010windows-server-2003-r2

ASP.NET Master Page Parser Error


I have this directory structure:

[website]
  [folder]
    Default.aspx
  Default.aspx
  Web.config

The Page Directive in the file in [folder] was created by Visual Studio 2010 when I added a new Web Form using Master Page:

<%@ Page Title="" Language="C#" MasterPageFile="~/Page.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="website.folder.Default" %>

When I run this application in the debugger (using localhost), it works fine.

When I push it up to the server (Windows Server 2003 R2), that same page produces a Parser Error on the Page Directive line:

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 '/website/folder/Page.Master' does not exist.

Source Error:

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

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1008

What needs to be configured on the server to eliminate this error message?


Solution

  • On our server, I used IIS Manager to delete all of the files in the [website] folder, then republished it through Visual Studio 2010.

    It seems to be working now.

    Clearly, I don't know enough about how the whole IIS system works!