By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,470 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,470 IT Pros & Developers. It's quick & easy.

make web.sitemap location dependent

P: n/a
I have 2 sites in my company. My .NET site uses a master page and a
Menu control connected to a sitemap. In my sitemap file I would like to
be able to do something like this:

<sitemap>
<sitemapnode site="City1">
<sitemapnode name="home" ... />
***other menu items here***
</sitemapnode>
<sitemapnode site="City2">
<sitemapnode name="home" ... />
***other menu items here***
</sitemapnode>
</sitemap>

When users in City1 or City2 request the home page, ASP.NET recognises
their location (by IP) and loads a location specific Master Page and
home page with a custom menu config. Some of the pages will be common
while others will be specific to the location. In this way, I would
only need to maintain one copy of common pages.

So is this possible without too much fiddling or should I just be
looking for other ways to do this?

Thanks
Mike

Mar 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

You need to look into a custom site map provider:

This will allow you to hide items as needed.
Unforunately, you'll have to loop on all items.

Or you can programmatically create the sitemap.

public class GranadaCoderSecureMapProvider : XmlSiteMapProvider
{
public GranadaCoderSecureMapProvider()
{

}
public override bool IsAccessibleToUser(HttpContext context, SiteMapNode
node)
{
//return base.IsAccessibleToUser(context, node);
string currentURL = node.Url;
if (currentURL.Length > 0)
{
//custom functionality here

// here is a simple substitution
return true;

}
return true;

}

}

And web.config section, dealing with this.

<system.web>
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="XmlSiteMapProvider" type="System.Web.XmlSiteMapProvider"
siteMapFile="~/Web.sitemap" securityTrimmingEnabled="true" />
<add name ="Company1SiteMap" type ="GranadaCoderSecureMapProvider"
siteMapFile="~/Sitemaps/confirmedUsers.sitemap"
securityTrimmingEnabled="true" />
</providers>
</siteMap>
"mike" <m_********@yahoo.com.au> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I have 2 sites in my company. My .NET site uses a master page and a
Menu control connected to a sitemap. In my sitemap file I would like to
be able to do something like this:

<sitemap>
<sitemapnode site="City1">
<sitemapnode name="home" ... />
***other menu items here***
</sitemapnode>
<sitemapnode site="City2">
<sitemapnode name="home" ... />
***other menu items here***
</sitemapnode>
</sitemap>

When users in City1 or City2 request the home page, ASP.NET recognises
their location (by IP) and loads a location specific Master Page and
home page with a custom menu config. Some of the pages will be common
while others will be specific to the location. In this way, I would
only need to maintain one copy of common pages.

So is this possible without too much fiddling or should I just be
looking for other ways to do this?

Thanks
Mike

Mar 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.