Last post Oct 04, 2013 03:58 AM by roigershon15
Oct 02, 2013 10:18 AM|roigershon15|LINK
my problem is: i have a web page in a directory that can't get access to the masterpage that place out of the directory
i have visual studio 2012 that gives me the next error:
"C:......./Deafult.aspx: ASP.NET runtime error: Failed to mapt the path '/MasterPage.master/'. "
thanks for your help :)
Oct 02, 2013 10:32 AM|LilBiggs02|LINK
It will be more helpfull if you post the top of Default.aspx. But i'm going to guess that at the top you have MasterPageFile="/MasterPage.master". Try chaning that to MasterPageFile="~/MasterPage.master".
Oct 02, 2013 10:35 AM|roigershon15|LINK
hi lil biggs02
i tried "~/MasterPage.master" and "../MasterPage.master" and "~/../MasterPage.master".
it didn't success in anyone of them :/
but if i try "../MasterPage.master" or "~/MasterPage.master" it doesn't show me an error but still my deafulat.aspx can't go to the MaterPage.
Oct 02, 2013 10:42 AM|LilBiggs02|LINK
What does your file structure look like? It the MasterPage.master on the same level as Default.aspx? Or is the default.aspx or master page in a different sub folder?
Oct 02, 2013 10:55 AM|roigershon15|LINK
the deafualt is in a directory and the MasterPage isn't. just like you said they are in diffrent sub folder.
Oct 03, 2013 04:25 AM|roigershon15|LINK
well i put my MasterPage in a directory and changed the path of the MasterPage of every page in my project and it works good, when i press on the design button it shows me the design of the MasterPage
but when i debug it is not work :/
Oct 04, 2013 12:03 AM|Steven Cheng - MSFT|LINK
I think it would be helpful if you can show us your clear file structure (under your ASP.NET web project) and the partial markup of the default.aspx page which try to reference the master page.
To make things simple, here is a simple test I've performed to show how to reference master page in different sub folder (from the concrete page).
# File structure under web project
Then, in order to let sub1.aspx use sub2.master, the directive in sub1.aspx markup looks like below:
<%@ Page Title="" Language="C#" MasterPageFile="~/sub2/Sub2.Master" AutoEventWireup="true" ...... %>
Oct 04, 2013 02:41 AM|roigershon15|LINK
When i use the properties it find the path automaticly right?? so i have a sub folder that i called MasterPage and it look like:
when i use MasterPageFile=" ~/MasterPage/MasterPage.master" it's not working.
well in my project i have 3 directories: Admin, Anonymous, Users. every directory has her own web pages, and every page need to get the access to the MasterPage.master
Oct 04, 2013 03:58 AM|roigershon15|LINK
Thank you everyone for your help, my problem was just to add the css again in the MasterPage because i changed the directory. :) :) :)