質問

I have multiple Master Pages arranged in a folder of my project that have the following path MyProject / MasterPagesFolder / Site.Master

And the pages of my project using the Site.Master have this path: MyProject / PagesFolder / ClientFolder / ClientPage.aspx

With this structure, the page does not load css style Site.Master but if the path of Teste.aspx page is changed to: MyProject / PagesFolder / ClientFolder / ClientPage.aspx the style of my MasterPage will work properly.   Why does this occur?

My MasterPage Initial Code:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Cliente.master.cs" Inherits="AcertSite.MasterPages.Cliente" %>

My WebPage Initial Code

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Cliente.Master" AutoEventWireup="true" CodeBehind="Teste.aspx.cs" Inherits="AcertSite.Paginas.Cliente.Teste" %>
役に立ちましたか?

解決

Like explained in this article http://msdn.microsoft.com/en-us/library/ms178116.aspx the "~/" is a relative path to the Web Application in IIS. If you are using IIS define the AcertSite folder as a Web Application (Contextual menu\convert to web application).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top