Tutorial :ASP.NET Saving webpage layout in a smart and fast way



Question:

alt text http://www.pafo.net/example.pngHello!

I don't know what i should title this question regarding ASP.NET and saving a webpage layout. I will be referring to BBC just illustrate what i am after. http://news.bbc.co.uk/

The page will have around 10,000-20,000 visitors each day. I have one MS SQL 2008 database and i am programming ASP.NET (C#) 3.5.

I am building a magazine/paper like BBC but in a smaller format, now the administrator has to be able to style the general pages (like Economics, Politics etc) and place what articles are to be display and how to display them. On the BBC page (when i'm looking at it now) you have one big article on the first row, then 2 smaller on the second and third row, then a box with "FEATURES, VIEWS, ANALYSIS". I attached a picture with the areas painted in different colors. I wan't to allow the administrator to modify the appearance of the general pages and thus place the news in an arranged order.

  • The first problem i have is how to save it for optimized speed, both for fetching the webpage but also for editing it. So i thought that saving the page in XML in a XML document would allow me to add the functionallity that i want, since i can modify the XML and also add new tags if i expand the program. But the problem is then loading it to the client, i could create a .aspx page on the server when the administrator presses save or i could dynamically load it every time someone wants to display the webpage. Any ideas on performance?

So the flow is: 1) Administrator changes the layout on a specific page in the admin panel, he or she changes what article to show and where to place them. (Single, Next to another article etc) 2) The administrator then saves the changes. 3) The user can now view the updated layout 4) The administrator can load back the layout to make further changes.

  • The second problem is that i have small boxes on the right side, the contents in these boxes could either reflect the article/webpage or it could be something different. The administrator chooses what boxes to use when he/she creates the article. Now, how to save that information and load the boxes efficient. The boxes, when they are created, faces the same problem as above, how to save them in a good manner so the articles can load them fast. I was thinking about saving the information, like above, in a XML document. When the administrator creates an article i then save the box id-number in a certain table in the MS SQL 2008 database with an id-number to the correct article. But the same problem arises, should i dynamically load the boxes or create every box as a Web User Control and then load it, something like: WebControl_1234 boxControl = (WebControl_1234)LoadControl("Data path" + box_id_from_sqlserver);

Any ideas?


Solution:1

Wow, this is a 'long question'. You might want to consider building it in a way you are most comfortable with e.g. data in DB, layout in aspx, dynamic/static WebControls etc.

Get it working before polishing, then run series of tests to have a idea of the performance and scalability. Caching mechanism can be a useful start.

This is by no mean a complete answer, just something to start the ball rolling.


Solution:2

If performance is top priority, nothing beats static html.

So, what do you think of making a system so the Administrator can change the layout and then save the generated page as html, so the webserver can pick it?

From CodingHorror.com

What's Movable Type's performance secret? For the longest time -- almost 5 years -- I used the version I started with, 2.66. That version of Movable Type writes each new blog entry out to disk as a single, static HTML file. In fact, every blog entry you see here is a physical HTML file, served up by IIS just like it would serve up any other HTML file sitting in a folder. It's lightning fast, and serving up hundreds of thousands of pageviews is no sweat. The one dynamic feature of the page, comments, are handled via a postback CGI which writes the page back to disk as each new comment is added. (This is also the source of the occasional comment disk write collision, when two commenters happen to leave a comment at the same time.) Yes, it's a little primitive, but it's also very much in the spirit of KISS: why not do the simplest possible thing that could work?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »