开发者

How to specify physical path in ASPX page?

I am developing a C# VS 2008 / SQL Server 2008 ASP.NET Web Applications project. In one of my ASPX files I am trying to reference the Master file, which is actually located in the parent website. In other words, when I open the parent website, I see this project listed. But when I open this project separately, I do not see parent website and this project is the root.

So now 开发者_如何学Gohow do I use the Master file from the parent website? Currently, I have in my ASPX file:

<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="EnhancedCreateUserWizard.aspx.cs"
    Inherits="Membership_EnhancedCreateUserWizard" Title="Untitled Page" %>

But this won't work because it is a virtual path and since this project is the root, I can't access the Master file virtually. Instead I want to specify physical path. How accomplish I do this?


You cannot share a master page between applications this way. All paths within an asp.net app are relative.

The virtual path provider simply will not reach above the current apps root.

You will need to either write a custom virtual path provider, which is not trivial, or package the master pages in a shared assembly.

You will find guidance in this question: What is the best way to share MasterPages across projects

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜