Developer forum

Forum » Development » Area not persisting correctly

Area not persisting correctly

Jonas Mersholm
Reply

I am creating a new website/area using the Area.Copy method. This is my code:

                Dynamicweb.Content.Area Ase = Dynamicweb.Content.Area.GetAreaById(areaId);

                Dynamicweb.Content.Area A  = Ase.Copy(Dynamicweb.Content.Area.CopyMode.StructureAndContent, false, true, true, true, false);

                A.Name = cleanName;

                A.Domain = cleanName;
                A.DomainLock = cleanName;

                A.Description = User.ID.ToString();              

                A.Active = true;

                A.LayoutTemplate = "Designs/site/dealer_show.cshtml";

                A.Culture = "da-DK";

                A.Save();

 

This works fine. The website is created, attached a template, set to active vice versa. The problem is that the website is not available through the domain until

a) I upload a new DLL, meaning the pool refreshes

b) I manually log onto the backend, opens the website in the website module and clicks "save" ( Without changing any properties )

 

Heres a video explaining the problem : http://screencast.com/t/nGu6gSKAcmQm

 

Thanks in advance.

Jonas


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Jonas,

Try this after A.Save();

Dynamicweb.Frontend.Reset.ResetHash(Frontend.Reset.HashType.Area);

This should reset the cache for frontend.

Long explaination is that Copy resets the cache but fills it again immediately. Then you change the area, but Save does not clear the cache, so the changed information is not available. This will be fixed in Dynamicweb 8.6.

- Jeppe

Votes for this answer: 1

 

You must be logged in to post in the forum