Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Programmatically created page not visible in edit mode with multiple sites

Vote:
 

Hi! I have two sites in the same EPiServer instance. I'm writing an admin plugin that takes some properties from a page on the first site and creates a page on the second from that information (a mobile version of the first page). The problem is that the newly created page is not visible in the second site until I recompile everything, which makes me think that it is a caching issue. If I run the admin plugin from the second site the change is reflected immediately. I've tried to remove the start page on the second site from cache by calling DataFactoryCache.RemovePage when creating the page but to no success. Does anyone know how to make the second site refresh if I run the plugin from the first site? Cheers!

#52615
Aug 05, 2011 13:10
Vote:
 

Hi Christer

Could you post the code you're using to create the page on the other site?

Frederik

#52624
Aug 06, 2011 11:54
Vote:
 

Here it comes:


int
fullProjectPageID = //ID of existing page;
PageReference
MobileStartPage = //Root node of second site; 

PageData projectStartPage = DataFactory.Instance.GetPage(new PageReference(fullProjectPageID)); 

PageData generatedPage = DataFactory.Instance.GetDefaultPageData(MobileStartPage, MobileProjectPageType.PageTypeID);

generatedPage.PageName = DataFactory.Instance.GetPage(projectStartPage.ParentLink).PageName;

generatedPage["FullProjectPage"] = projectStartPage.PageLink;

generatedPage["PageHeading"] = projectStartPage["PageHeading"];

//etc for all properties


foreach (PageData sibling in DataFactory.Instance.GetChildren(projectStartPage.ParentLink))
{
    if (sibling.PageName.Equals("Bilder"))
   
{
             generatedPage["ImageAlbum"] = sibling["ProjectImageAlbum"];
       
break;
   
}

DataFactory.Instance.Save(generatedPage, EPiServer.DataAccess.SaveAction.Publish);

/* I've tried adding DataFactoryCache.RemovePage(MobileStartPage) here but the result is the same */

#52641
Aug 08, 2011 9:58
Vote:
 

Do you use more than one front web server in this setup? Are you serving the mobile web site from a different front web server perhaps? In that case it's probably the cache synchronization between servers that isn't working.

#52643
Aug 08, 2011 12:03
Vote:
 

We do have a load balanced environment yes, but in this case I'm still on my development machine running a local IIS instance in Windows Vista.

#52646
Aug 08, 2011 13:01
Vote:
 

And these sites are both served by the same Application in IIS?

#52651
Aug 08, 2011 13:59
Vote:
 

They use the same AppPool yes, and they are both visible in the same EPiServer UI. However, I cannot log in to the second site in IE due to an exception: "This request has probably been tampered with. Close the browser and try again." In Google Chrome it works. Perhaps this has something to do with it?

#52653
Aug 08, 2011 14:05
Vote:
 

The same App pool is one thing, but are they the same app = site in IIS? I'm thinking you have two apps pointing to the same directory? In that case they won't share memory and they will have to be cache-synchronized in the same way as load-balanced applications (as they "share" content).

#52654
Aug 08, 2011 14:18
Vote:
 

That must be it! I've deleted the second site in IIS and just added it as a binding to the first. However, this produces the error message Application is initialized with settings for siteId="X", but current request maps to siteId="Y". I guess I have to set up remote events on my developer machine and use two apps in IIS. Thanks for the help!!

#52657
Aug 08, 2011 15:37
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.