Bugs in siteMapProvider. SiteMenu

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
8/7/2006 10:11:50 PM
kwa
Gravatar
Total Posts 23

Bugs in siteMapProvider. SiteMenu

First off, I'm glade that mojoPortal.com is back online again.

I just found a bugs in the siteMapProvider. If I run the portal for a single website, it is ok, the menu works perfect, but when there are two websites. Let's say I have set up mojoPortal to host two website: site1/mojoportal and site2/mojoportal, and then I launch two browsers one for site1 and another for site2, I hit site1 for 3 or four time, then switch to site2, surprisingly the menu for site1 appear on site2 for 1 or 2 minutes. when that happen, I cannot browse away from the front page to any other page of site2 because the pageid is not valid.

When the cached of site1 expired, I hit site2 for 3 or 4 times, then I switch to site1, I will see menu of site2 appear on site1.

 

Thank YOu

 

8/8/2006 6:08:07 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

Hi,

I'm glad the site is back up too!

Yes, I'm aware of this issue with sitemap caching. I haven't figured out a good solution for this so if you are interested in exploring how to handle this problem I'd welcome the help. Themes are also cached but since most of the skins use css its less noticeable except in things like the calendar which does use theme settings.

It is possible to work around this issue because caching happens at the application level so if the sites are configured with different application boundaries it does not happen.

To do this you must configure a separate IIS web site or virtual directory application and use different hostnames.

So for example if the physical directory is located at
c:\projects\mojo\web
and mapped to a virtual directory
http://localhost/mojo
create another virtual directory that maps to the same physical folder
http://localhost/mojo2

now they are still using the same data because the host names are the same localhost but if you add a new hosts entry in your hosts file
Windows\system32\drivers\etc\hosts
127.0.0.1 myhost
and configure the hostname myhost for the second site, you can access it from
http://myhost/mojo2
and it will be completely independent with no cache issues

You can do this also (on server not on XP) by adding a new web site instead of virtual directory. Point the web site to the same folder and add a host header so it handles requests for the second host.

The downside of this is that more server resources are used by having multiple applications but it does work.

Hope it helps,

Joe
8/8/2006 8:14:40 AM
kwa
Gravatar
Total Posts 23

Re: Bugs in siteMapProvider. SiteMenu

I am not  aware of Theme caching, and obviously it is not the issue.

I did registered two host names in the host file that I can have two different site: http://site1/mojo and http://site2/mojo  . I did not use just virtual directories. And the portal does not support mutiple virtual directories hosting too.

 

Thank for the response.

8/8/2006 8:23:11 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

theme caching is not the issue you were asking about but it is an issues from the same cause, asp.net runtime does caching at the application level for sitemap and also for themes. I only mention themes because it has the same cause for the problem. The cause of the problem is that asp.net runtime caches things at the application level.

as I said the workaround for this is to have separate applications which means separate virtual directories pointing to the same physical directory, so you need
http://site1/mojo1
and
http://site2/mojo2

if you can find a better solution please let me know

I don't currently know a way to prevent the asp.net runtime from caching sitemap and themes at the application level
but there might be a way that I don't know about.

Joe
8/8/2006 9:18:39 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

I've posted a question about this in the ASP.NET forums

http://forums.asp.net/thread/1364630.aspx

Maybe someone will have a good solution.

Joe
8/9/2006 9:57:46 PM
kwa
Gravatar
Total Posts 23

Re: Bugs in siteMapProvider. SiteMenu

I did not try to change this yet, but I believe the menu was cached because you implement "StaticSiteMapProvider" instead of "SiteMapProvider".
8/10/2006 3:23:54 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

I don't think so. The SiteMapProvider knows about the different sites, the caching happens above the sitemapprovider so it doesn't even hit the sitmapprovider code once it is cached.
8/10/2006 3:29:46 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

on second thought maybe that is the issue, maybe the caching is managed by the base class, I'll look into it further
8/10/2006 3:45:54 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

well looking through the members of SteMapProvider
http://msdn2.microsoft.com/en-us/library/system.web.sitemapprovider.aspx

I don't see anything relating to managing things in the cache so I'm doubtful that it would be any different inheriting from SiteMapProvider instead of StaticSiteMapProvider

Joe
8/10/2006 9:02:52 AM
kwa
Gravatar
Total Posts 23

Re: Bugs in siteMapProvider. SiteMenu

You are right, StaticSiteMapProvider is just an extend version of SiteMapProvide, it's not the cause of the issue. I was also wondering the menu control cached the data, but when I looked into the source code there is no caching in the code at all.

Whatever cached the menu is still the mystery, we need some help from Microsoft.

8/10/2006 9:15:17 AM
Gravatar
Total Posts 18439

Re: Bugs in siteMapProvider. SiteMenu

Actually, I just got some help from Microsoft, I've been emailing with Scott Guthrie and Clay Compton and I think there is an at least workable solution that I can implement easily enough for the next release.

I will have to declare additional SiteMapProviders in web.config even though they use the same code they will have different names like mojosite1, mojosite2... and then programatically assign them to the menu based on the siteid like "mojosite" + SiteID.ToString()

so maybe I will configure like 10 and have documentation how to add more if needed

http://msdn2.microsoft.com/en-us/library/ms178426.aspx has some good info they refered me to.

Quoting Clay,
"To answer your key question:  while it's entirely possible to have more
than one instance of the same SiteMapProvider class in your application
(and the MSDN topic I referred you to shows how to do this
declaratively) there isn't a way to programmatically add providers to
the SiteMap.Providers collection.  If it's possible to know in advance
how many logical sites an instance of your portal solution would need to
maintain, the user could configure a separate SiteMapProvider for each
logical site.  Is that a workable solution?"

This will definitely be better than having to configure additional IIS apps and less server load as well.

Really I would never recommend hosting multiple customers this way, its more professional to keep them separate but I think its good for multiple sites for the same customer or say for department level intranet sites at a company.

I'll try to get this working soon.

Cheers,

Joe
You must sign in to post in the forums. This thread is closed to new posts.