Skip to main content

Cloud

Performance anxieties

SharePoint performance – the missing piece.

If you have ever looked at the HTML source of a rendered SharePoint web page (and who hasn’t?) you’ll see that the output of a zone contents i.e. a webpart, gets dumped into a div tag which in turn is part of a page level table. All good stuff.

Problems occur because we developer types try to stuff as much functionality and ease of use into our webpart and so does everybody else. If our webpart uses a postback then not only must it re-render, so does all the other webparts. Combine this with the fact that we very rarely use Session objects in SharePoint development to cache data and you get an application that is as responsive as a government agency (with the exception of our friends at the IRS).

So, what can we do (crying is not an option – there’s no crying in webpart development?

For any demanding OLTP (Online Transaction Processing) applications that are hosted in a webpart my current philosophy is to build the application as a standalone IIS web app and point to it from the webpart.

As described in a previous blog, using a generic SmartPart allows to concentrate on application development and when ready configure the webpart to point to the User Control. Well consider this:

Generic webpart that is basically an iFrame that point to external web application.

Here’s how it works:

  1. Create a SmartPart that has an iFrame with a configurable SRC, width and height properties. Add this to the SharePoint webpart library. The RenderWebPart method might look like the following:

protected override void RenderWebPart(HtmlTextWriter output)

{

string html = "<iframe src=’" + m_url + queryString + "’ style=’width: “ + m_height + “%; height: “ + m_height + “%;’ scrolling=’no’ frameborder=’no’>" + "</iframe>";

output.Write(html);

}

Where m_url, m_height and m_width are configurable properties.

  1. Build your web application and deploy to SharePoint and/or if developing on the SharePoint server you need to exclude the application’s path from within the SP Administration as follows:

Site Settings

General settings/Go to SharePoint Portal Server central administration

Portal Site and Virtual Server Configuration/ Configure virtual server settings from the Virtual Server List page

Default Web Site (or SharePoint web site)

Virtual Server Management/Define managed paths

Add a New Path: enter relative path in textbox

Select Excluded path radio button

Click Ok

  1. Configure the generic SmartPart to point to your web application.

Now when your iFrame hosted application does a postback it will do so without affecting any other webparts on the page.

Of course this would also work for a SmartPart hosted UserControl that had an iFrame as its main content container.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Aaron Steele

More from this Author

Follow Us