Friday 22 April 2011

Create new page for DotNetNuke in background

Prehistory:
Some customers need to create a lot of pages at one time. This is why "Bulk Pages Creation" has been added to the Pages Admin - Tabs Manager. But few days ago one customer submitted bug. He tried to create about 500 pages in bulk. Less then 100 have been created, but other have been failed. Problem is httpRuntime executionTimeout in the web.config has small time and after 90 seconds (default value) it fails.

History:

To fix this problem idea of bulk pages creation for DotNetNuke has been changed. Right now all bulk tasks put to the DataBase and then process in separate thread starts to create pages. Everything works like a charm. Only one issue happens. When you select template for Bulk Pages Creation, it creates all modules, permissions and settings, BUT it does not fill modules with content. This is very critical for customers who fill pages with a lot of modules (for example HTML modules).

It has taken almost a day to find a problem. Problem in the method:

DotNetNuke.Entities.Modules.ModuleController.GetModuleContent(XmlNode nodeModule, int ModuleId, int TabId, int PortalId)

It has line:

innerXml = HttpContext.Current.Server.HtmlDecode(innerXml);

This code works good when user works within portal, but when we create pages and modules in background, then HttpContext.Current.Server returns "Object reference not set to an instance of an object". To fix this we had to move all Panes Deserialization from the DotNetNuke to the separate class and replace this line with this one:

innerXml = System.Web.HttpUtility.HtmlDecode(innerXml);

It works much more better now.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.