Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Specifying Location of Site.Master
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01606359
Message ID:
01606383
Views:
37
>>In another thread I wrote that, when placing pages of the project in a virtual application and in sub-folder of the site, I came across a problem where specifying location of Site.Master as follows didn't work:
>>
>>@ Page Title="User Login" Language="C#" MasterPageFile="~/Site.Master"
>>
>>
>>The tilde (~) in front of the Site.Master was pointing to the root of the site (where there is no Site.Master file).
>>
>>Changing the location to the following (in a test page) works:
>>
>>@ Page Title="User Login" Language="C#" MasterPageFile="./Site.Master"
>>
>>
>>That is, placing a period in front of the slash resolved the issue.
>>
>>Now before I go through all pages of the project and change the tilde to a period, I would like to ask. What if - in some case - I pace these pages not in the virtual application sub-folder to the site but in the root site itself? Will "./Site.Master" work for those case? That is, I want to be sure that I don't have to change this back and forth depending on where the pages will reside.
>>
>>TIA.
>>
>>UPDATE. I also found msdn page describing how the location of Site.Master can be set at the application level. This is done by specifying the location in web.config as follows:
>>
>><pages masterPageFile="MySite.Master" />
>>
>>So I am considering this approach too. Let me know if you know a downside of this approach.
>
>Firstly, in the previous thread, I didn't, for some reason, twig that you had a nested application so most of my suggestions were barking up the wrong tree.
>
>Snip : Will "./Site.Master" work for those case?
>
>No. It's looking in the current folder. If Site.Master IS in the root folder then it won't work.

What I meant is that my Site.Master is always in the same folder as the aspx pages. So I were to have this child application as parent (residing in the root of the site) then the Site.Master and pages will be in the same - root - folder. So I suppose in this case "./Site.Master" should work. Right?

>
>The msdn page link didn't work but I'm guessing it was:
> http://msdn.microsoft.com/en-us/library/vstudio/wtxbf3hh(v=vs.100).aspx#MasterPagesAndContentPagePaths
>
>Sounds like setting at the application level should be fine (I'd assume, although not stated, that you could override at the page level if necessary)

I will play with the application level approach too to see how it goes.

Thank you,
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform