Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • micbsv 4 posts 22 karma points
    Nov 08, 2009 @ 10:58
    micbsv
    0

    Separated web.config files in sub-domains

    I'm trying to host multiple web-sites on a single Umbraco instance.

    The sites are located in Umbraco\websites\site1, Umbraco\websites\site2, etc. folders. Every site has a set of Users with some privileges, like:

    <authentication mode="Forms">

    <forms name="yourAuthCookie" loginUrl="login.aspx" protection="All" path="/" />

    </authentication>

    <authorization>

    <allow users="*" />

    </authorization>

    ...

     

     

     

    <location path="admin.aspx" allowOverride="true">

    <system.web>

    <authorization>

    <allow users="webSite1Admin" />

    <deny users ="*" />

    </authorization>

    </system.web>

    </location>

     

    ...

    Additionally every web-site must have their own appSettings.

    It looks like the optimal way to go is crating separated web.config files for every web-site and putting them in their folders like Umbraco\websites\site1\web.config, Umbraco\websites\site2\web.config, etc.

    Unfortunately Umbraco doesn't pick up settings from the web.config files for the web-sites.

    How can I make Umbraco to do it?

    If it's not possible, what is the best way to implement my configuration?

  • Stephan Lonntorp 195 posts 212 karma points
    Nov 08, 2009 @ 12:37
    Stephan Lonntorp
    1

    What are the appsettings needed? Maybe you could implement them as properties on the site root nodes?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 08, 2009 @ 15:34
    Dirk De Grave
    0

    Agree with Stephan, it could/would be much more easy/practical to get all application settings as properties on each top level node (which would represent a website), and let umbraco handle the multiple web part (don't forget to assign host headers to your top level nodes)

     

    Cheers,

    /Dirk

  • Petr Snobelt 923 posts 1535 karma points
    Nov 08, 2009 @ 15:39
    Petr Snobelt
    0

    You can try use location tag in web.config this way you can change SOME settings for subfolders

  • micbsv 4 posts 22 karma points
    Nov 09, 2009 @ 06:12
    micbsv
    0

    >What are the appsettings needed?

    I have a bunch of my own controls and I wanted to keep some IDs and settings in the individual web.config files.

    >Maybe you could implement them as properties on the site root nodes?

    It sounds like a solutions if there is any way to get access to the properties from my own code.

    Could you please give me some code example?

    Thanks a lot for your help!

  • Stephan Lonntorp 195 posts 212 karma points
    Nov 09, 2009 @ 07:39
    Stephan Lonntorp
    0

    You can always get the current Node by accessing presentation.nodeFactory.Node.GetCurrent(), from there you can traverse the tree upwards and fetch those properties needed

    OR

    you could use  a new instance of presentation.nodeFactory.Node(int pageId), if you know the ID of the root page.

     

    You could also use umbraco.library.GetNodeFromLevel(string path, int level), where path is your node's @path attribute, i.e. "-1, nnnn, nnnn"

     

    Good luck!

Please Sign in or register to post replies

Write your reply to:

Draft