user153923
user153923

Reputation:

ASP.NET Master Page Parse Error

I have a Visual Studio 2010 project with a Master Page that works fine.

~/Site.Master

In the same project is a Folder with another directory structure that needs to use another Master Page.

/xr

Within this folder, I have included the Master Page for those files.

/xr/XR.Master

My Default.aspx file attempts to access this Master Page using the following include:

<%@ Page Title="XR Project" Language="C#" MasterPageFile="~/xr/XR.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test1.Default" %>

Debugging on my machine in localhost works fine, but whenever I deploy it and try to navigate to the Default page in the xr folder, I get

Parser Error Message: The file '/xr/xr/XR.Master' does not exist.

However, the Source Error returns Line 1 as I have shown above.

Here is what I tried:

Parser Error Message: The file '/xr/~/XR.Master' does not exist.

What am I doing wrong?

EDIT: I do not like posting a link to the page, but I will for a short time until this is resolved:

From there, you will see everything works well enough except for the link to XR1200.

Upvotes: 2

Views: 4321

Answers (2)

Dylan Hayes
Dylan Hayes

Reputation: 2366

Here's the best advice I can give ya without knowing too much about your project structure. I'm hoping you are using VS2010 so that things will look the same for you as on my machine. One easy way to get the path of your master page all figured out is to add a test web page from masterfile, the path will be preset for you and you can use that in your existing pages.

  • Here is my blogs project structure. Right click the folder where you want to add the test page and click add new file.
    enter image description here

  • Add a new web form using Master Page. This is just for testing. enter image description here

  • Now locate your Masterpage and select it. enter image description here

  • From here just find your newly added content page in your solution structure and check the code files for the path to your masterpage. enter image description here

  • Once you've verified that your path is correct, if it still bombs once you publish it then you've got either an issue where not all of your projects are building properly, or you're files aren't being uploaded properly and that is going to end up being something that you may just have to find on your own. I still suggest blowing away anything in your pub folder on your server and trying a clean publish.

Hope this helps!

Upvotes: 3

Dave Rael
Dave Rael

Reputation: 1759

my guess is that the iis setup is different on the different machines. typically, you see something like this when you have one machine set up with the site itself as a website and another machine set up with the site itself as an application within a website (like the Default Website). it looks like you have addressed this possibility by using the ~ in the path, but perhaps the iis on which you are deploying does not have the site directory itself set up as either a website or an application, but is merely a subdirectory of a site. in that case, the ~ would refer to the website directory (perhaps named xr?) and the site is in a subdirectory of that named xr. if this is the case, the solution is probably to set up iis such that you have the application directory configured as an application on the server to which you are deploying.

Upvotes: 1

Related Questions