Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Specifying Location of Site.Master
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Specifying Location of Site.Master
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:
01606359
Views:
35
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.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform