Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SiteMaster and web.config
Message
De
25/08/2014 11:38:40
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01606317
Message ID:
01606364
Vues:
38
>>>Never mind
>>
>>I assume this is associated with the 'Specifying location of SiteMaster' post. :-}
>>
>>IAC, if you want to keep the SiteMaster page identical in both sites I was going to suggest using 'Add Existing Item' using the 'Add as Link' option.
>>That will ensure that any changes are reflected in both sites.
>
>I replied to your message a few minutes ago but all what I typed (the entire paragraph) is gone now. Strange.
>
>Anyway,
>You are correct that my issue has to do with the Site.Master. Here is the latest thing that I am trying to resolve:
>1. Changed the location of the MasterPageFile in the child project (running in the virtual application) from ~/Site.Master to /Site.Master (since tilde refers to the root of the site).
>2. The parent site (running in the root folder) does not have Site.Master. And the parent site runs under Forms Authentication
>3. I changed the web.config of the child site to run under Anonymous Authentication.
>
>So now when I try to open a page from the child application (e.g. MyChildPage.aspx) as follows:
>
>mycomputername/MyMainApp/MyChildApp/MyChildPage.aspx
>
>
>I get error:
>
>The virtual path '/Site.Master' maps to another application, which is not allowed.
>
>Source error points to this:
>
>@ Page Title="User Login" Language="C#" MasterPageFile="/Site.Master"
>
>
>Please let me know if you see what I am missing. Thank you.
>
>UPDATE. I found the problem (can't explain it though). When I changed the location of MasterPageFile from
>
>MasterPageFile="/Site.Master"
>
>to
>
>MasterPageFile="./Site.Master"
>(just added a period before the first slash)
>
>
>I no longer get error. On to the next test.

Glad you got it working (but I'm not sure why that made a difference either).

Looking at this it seems as if a good solution is to:
(a) put your sitemaster files in a folder outside the IIS structure.
(b) Create a virtual directory (for e.g. named 'Masters') in the root of your website pointing to the physical folder above.
(c) Change the aspx page MasterPageFile attribute to '~/Masters/Site.Master"

That allows you to use the same Site.Master in multiple sites.
Note : Depending on the project type you may, in Site.Master, need to change the CodeBehind Attribute to CodeFile
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform