ASP.NET 2.0 introduced the CompilationMode attribute to let the developers decide how to compile individual pages, user controls and master pages. You can set the value to these three values:

  • Always
  • Auto
  • Never

This is the definition from MSDN:

"The CompilationMode enumeration values indicate whether a page or control should be compiled at run time. When no compilation mode is specified, the default value is Always. Setting a page to never compile using the Never attribute will increase performance by disqualifying the specified page in the compilation process."

The attribute can be set on the individual page and control declarations like this:

<%@ Page compilationMode=”Never” %>
<%@ Control CompilationMode="Never" %>

Or in the web.config’s system.web section.

<pages compilationMode="Auto" />

If you set the CompilationMode to Never on a page, that page will never get compiled. If there is any C#/VB code on that page an error will be thrown. I use it for user controls that don’t have any code, but still hosts various controls like other user/custom controls or the built-in Login control. If there are lesser pages to compile, you get a slight performance boost.

I recommend that you don’t use the web.config to set the CompilationMode, but on the individual pages and controls to avoid surprises. However, if you want to apply this to an already existing web application it’s much easier to set the CompilationMode to Auto in the web.config depending on the size of the web application.

As you can see at the bottom of each blog post, I’ve added social bookmark links. Because I use dasBlog version 1.8 it was very difficult to do, mainly because there is no macro to print out the title in clear text of the individual blog posts. Michal showed us how to add the macro to dasBlog in a very easy way. The only problem is, that I’ve uninstalled Visual Studio 2003 and I don’t want to install it again just to add a macro to my blog.

I knew that the only way to do it was by JavaScript and I didn’t like it at all. But in the end, it turned out pretty good. This is the JavaScript that I added to the footer of the ItemTemplate:

<script type="text/javascript">

  var tn = document.createTextNode('<%ItemTitle%>');

  var div = document.createElement('div');

  div.appendChild(tn);

  var html = div.innerHTML;

  var index = html.indexOf('&gt;') +4;

  var title = html.substring(index, html.length - 10);

  var social = '<div style="float:left">';

  social += '<a href="http://digg.com/submit?phase=2&url=<%permalinkUrl%>&title=' + title + '">Digg it</a>&nbsp;|&nbsp;';

  social += '<a href="http://www.dzone.com/links/add.html?url=<%permalinkUrl%>&title=' + title + '">dzone it</a>&nbsp;|&nbsp;';

  social += '<a href="http://www.dotnetkicks.com/submit?url=<%permalinkUrl%>&title=' + title + '">Kick it</a>';

  social += '</div>';

  document.writeln(social);

</script>

You can fairly easy add other bookmarks than the ones I’ve implementet. If you use the new dasBlog 1.9 you don’t have these problems, because it come with the blog post title macro out of the box.

>