Click here to Skip to main content
12,950,272 members (65,125 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 6 May 2012

How to Add Content Management to Your Existing ASP.NET Web Site

, 8 May 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Enhance your old ASP.NET web site with modern Content Management features


I was looking for a Content Management System to power my old ASP.NET web site. I didn't expect it to be that hard to find something reasonably good, but it was hard. So I decided to research the problem and share my experience here.

The fact is that for some reason almost all CMS vendors assume that I am eager to rebuild my web site from scratch. The advertisement focuses on how easy it is to install CMS and how many features there are. It is getting vague when describing how I am supposed to move my existing content to the new system, and it mostly ignores all business functions of my site and all proprietary code I currently have.

Such approach does not look adequate in the second decade of the 21st century. A company web site these days is more than text and pictures - it does business. It has been rebuilt many times already, saturated with unique code and business functionality. Saying that one can easily move a business web site into some prepackaged CMS would not be an accurate assessment.

Content management is just one of many functions of a modern web site. It's not reasonable to throw away all other vital functions just to get this one. Why can't we simply add content management features to an existing web site without sacrificing site's business purpose?

The whole idea of a CMS being the foundation of a web site is outdated. Technology is way past the state when you had to build everything from scratch again and again. Modern systems can evolve, and so should evolve our web sites.

So, here are the reasons why it's hard to find a CMS to enhance existing web site:

1. It is not practical to throw away a web site that already fulfills its business purpose.
2. Business evolves, it is hard to predict which CMS features it will need tomorrow. CMS vendor lock-in can impose unnecessary features on business and deprive business of features it might need in the future.
3. IT departments are reluctant to install yet another software package in their already overpopulated server room. IT departments want to build IT systems their way, not the way imposed by a CMS vendor.
4. We do want to keep our existing web sites. We want the ability to add content management features when we need them without destroying the whole system.


So, what kind of technological marvel I was looking for?

It took me a while to recognize the requirements:

1. Drag and Drop. May be not literally, but the idea is the same - I should be able to add content management functionality to web pages without disturbing all other functions of my site.
2. À la carte features. I should be able to add new features into my existing web site when I need them.
3. Configuration over programming. I should be able to configure my way out of most situations. Programming should be the way of last resort.
4. No software to install. I can tolerate a small software piece that I should drop on my servers, but the bulk of the system should reside elsewhere. If this sounds like a cloud-based solution, that's because it probably is.
5. Choice. I want to do everything my way. The system should adapt to whatever IT environment I have, should adapt to the way my web site currently works.

As extreme as these requirements may sound they are actually a tribute to evolution - nowadays technology can afford evolutionary ways. In short - don't replace your existing web site, upgrade it.

Several Ways to add Content Management to a web site

As you can guess, majority of existing Content Management Systems cannot fulfill my dream entirely. But there are ways to get pretty close to the desired result.

Two basic choices:

a) install any well-known CMS side-by-side with your old web site and write code to somehow transfer content from CMS to web site at runtime;

b) use specialized solutions that were designed to inject managed content into existing web sites.

Which solution you choose depends on how you prioritize the requirements, primarily on how much programming and how much interference in your existing web site you are going to tolerate.

Side by Side with Front-end Integration

This is probably the most obvious way - deploy a new web site powered by a CMS of your choice, and show its pages on your old web site using an IFRAME or a JavaScript code.

Update [May 8, 2012]: As some readers pointed out, in most cases integration through IFRAME or AJAX is not really a good idea in terms of Search Engine Optimization. IFRAME integration also requires careful attention to all links in managed text because those links should target parent frame to update the whole page, not only IFRAME content. For real life business web sites specialized solutions like ElasticWCM (see below) would be the primary choice. In such solutions cloud-based system provides all content management features, versioning, permissions - injecting multiple content fields into designated areas on the web page in appropriate language, sometimes according to a publishing schedule. It's hard to beat specialized systems, especially when they are free

Connect through IFRAME

Here you are replacing part of the page with an IFRAME in which you display content from your new CMS.

If on the old web site you had a page like this

<html xmlns="">
   <title>My Page on old web site</title>
   <div> header here...</div>
   <h1>Page Title</h1>
   <img alt="my picture" src="picture.jpg" />
   <p>Some text...</p>
   <div> footer here...</div>

you would change it to contain an iframe referencing a page on your new CMS:

<html xmlns="">
   <div> header here...</div>
   <title>My Page on old web site</title>
   <iframe src="[New CMS page URL goes here]" width="900" height="600" frameborder="0"></iframe>
   <div> footer here...</div>

You should change the size of the iframe to match your web site design.

Connect through JavaScript

jQuery made it really easy to load content from a different page.


1. On the CMS page identify or create an Html element (most likely DIV) holding managed content, that will be the source of data. Let's say its ID is "content".

2. On content pages in your old web site define a DIV that will hold managed content, assign some ID to it, for example "container".

3. Add JavaScript code retrieving Html from "content" DIV on the CMS page and populating "container" div on the web site page:

$(function() {
   $('# container').load('cmsPageUrl #content');

Many content management systems create an RSS feed for the page content, that represents another option - you can query that RSS using JavaScript. jFeed - a jQuery RSS/Atom plugin makes it easy.

Note, that in both described cases your CMS will also be accessible to Internet users if they figure out the URL to it. If that is not what you want you should probably consider back-end integration, where you can hide CMS from public view.

Side by Side with Back-end Integration

Technical details of this solution greatly depend on the type of CMS you are going to use.

An example of rather sophisticated solution would be integration with MS SharePoint Foundation.

You can use SharePoint as your backend storage with rich HTML editor, advanced permission management and collaboration features.


1. Install SharePoint Foundation 2010 (free download from Microsoft site:

2. Create new SharePoint farm, then new Web Application and Site Collection with blank site in the root.

3. In the root site create a custom list, call it "MyPages". In that list Title field will hold page name that you will use in your queries to identify the page.

4. In your custom list define new HTML text field, which will hold content of your page. Call the field "PageHtml"

5. Somewhere in the old website's project create a function that will retrieve the value of the PageHtml field:

public class MyContent
   public static SPListItem GetPageItem(string pageName)
      using (SPSite site = new SPSite("http://mySpSiteUrl"))
         using (SPWeb web = site.OpenWeb())
            string listUrl = web.ServerRelativeUrl + "/lists/MyPages";
            SPList list = web.GetList(listUrl);
            SPQuery query = new SPQuery();
            query.Query = string.Format("<Where><Eq><FieldRef
Name='Title'/><Value Type='Text'>{0}</Value></Eq></Where>", pageName);
            query.ViewFields = "<FieldRef Name='Title' /><FieldRef Name='PageHtml' />";
            SPListItemCollection items = list.GetItems(query);
            if (items != null && items.Count > 0)
               return items[0];
      return null;

Now, on any page of your old ASP.NET web site you can call this function to retrieve the page Html and display it instead of hardcoded content. The SharePoint site will provide you with all content management functionality.

Using Specialized Systems

There are a few systems on the market designed to update existing web sites.

One approach is to connect third-party CMS to the back-end storage and let it to update web site files behind the scenes. Examples here: CushyCMS and Instant Update CMS. This is rather unsophisticated method, depriving you from many features that a modern content management system must have. Also, making direct changes in the site's source files would most likely violate software deployment process in most companies.

With raising popularity of cloud-based solution new type of content management systems start emerging. Such systems establish connection with your web site, keeping content database in the cloud, and injecting content into web pages at runtime through well-encapsulated content controls.

A good example is ElasticWCM From the developer's point of view ElasticWCM is just a free set of ASP.NET controls packed in a single DLL. Placing those controls on web pages is all that is needed to convert an ASP.NET web site to a multilingual content management system without writing a single line of code. And because it's free, anyone can play with it to see if it works for a particular solution.

Points of Interest

One place to watch is the Windows Azure Marketplace. There are free solutions out there that might help you to augment your web site with useful functionality.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

NewsTotally agree with the concept Pin
captainvp29-Apr-16 5:32
membercaptainvp29-Apr-16 5:32 
GeneralMy vote of 1 Pin
vijay makwana25-Jul-14 7:49
membervijay makwana25-Jul-14 7:49 
GeneralMy vote of 3 Pin
HaBiX8-May-12 23:14
memberHaBiX8-May-12 23:14 
QuestionSEO is important Pin
avsol8-May-12 7:08
memberavsol8-May-12 7:08 
GeneralMy vote of 3 Pin
terrykernan8-May-12 1:32
memberterrykernan8-May-12 1:32 
QuestionNice idea, just needs a caveat.. Pin
terrykernan8-May-12 1:31
memberterrykernan8-May-12 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170525.1 | Last Updated 8 May 2012
Article Copyright 2012 by avsol
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid