April 2007 - Posts

ASP.NET Ajax and Community Server

Apr 05 2007, 07:29 PM By jeffesp; 1 Comments

I decided I wanted to use some features from ASP.NET Ajax and the AjaxControlToolkit in my Community Server install.  It was actually relatively simple.  Here's what I did:

  1. Download and install ASP.NET Ajax
  2. Download and build the AjaxControlToolkit.  Install AjaxControlToolkit.dll to GAC (copy to c:\WINDOWS\assembly, or use gacutil /i).
  3. Create a new ASP.NET Ajax WebSite in Visual Studio.
  4. Grab everything from the web.config in the new WebSite.
  5. Merge into web.config in Community Server.
  6. Add the following to the web.config:
<pages>
    <controls>
        <add tagPrefix="AJAX" namespace="System.Web.UI" 
            assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add tagPrefix="AJAXKIT" namespace="AjaxControlToolkit" 
            assembly="AjaxControlToolkit, Version=1.0.10201.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
    </controls>
</pages> 

It really was that simple.  I was able to add a ScriptManager to my master page as required by ASP.NET Ajax and then I was able to add AjaxControlToolkit controls to my page and they just worked.  If you notice the 'Blog Actions' area on the right - you can click it and it will expand.  This is the CollapsiblePanelExtender from the AjaxControlToolkit at work.

(Although this site doesn't quite work with Firefox yet...)

SiteUrls.config for blog only site

Apr 05 2007, 04:17 PM By jeffesp; 0 Comments

There's a lot of info about how to host CS so you have only a single blog and gallery at the top level.  In fact, CS 2007 has a great feature where you can override the default settings in siteurls.config without the file itself. Scott Watermasysk has provided the siteurls_override.config and communityserver_override.config needed to host one blog at the top level. For this current site I wanted to host multiple blogs at the top level.  So I took the default that Scott provided and removed two lines.  The important thing is to know which two lines to remove.  Here's what creates a single blog at top level site:

<?xml version="1.0" encoding="utf-8" ?>
<Overrides>
   <Override xpath = "/SiteUrls/locations/location[@name='weblogs']" mode = "change" name = "path" value = "/" />
    <Override xpath = "/SiteUrls/locations/location[@name='weblogs']" mode = "new" name = "physicalPath" value = "/blogs/" />
</Overrides> 

This is the first line removed:

<Override xpath="/SiteUrls/transformers/add[@key='##blogdirectory##']" mode = "change" name = "value" value = "" />

It changes the transformer named ##blogdirectory## so it doesn't do anything.  The default for this is to add the blog path to the value being transformed.  For a single blog at the root, this is what you want.  Without this line the path to the blog would contain things like 'jeffesp'.  Obviously this is behavior that I needed, so I removed it.

The second line removed:

<Override xpath = "/SiteUrls/locations/location[@name='weblogs']" mode = "change" 
   name = "type" value = "CommunityServer.Blogs.Components.SingleBlogLocation, CommunityServer.Blogs" />

This changes the url rewriter for the blog location.  Instead of doing looking up the blog and figuring out the url from there, all the SingleBlogLocation url rewriter does is grab the ApplicationKey for the blog and insert it in the path between the site base path and whatever blog page is being requested.  An example will make this clearer:

If I were to request http://blogs.atgi.com/default.aspx and my blog application key is jeffesp, with this override in place, the request would come across (to the rest of the CS system) as http://blogs.atgi.com/jeffesp/default.aspx because jeffesp would be added to it.

Client Side Syntax Highlighting

Apr 03 2007, 01:54 PM By jeffesp; 1 Comments

A little while ago, I found a client side syntax highlighting library because I was using blogger.  Since I am now using a community server install, I wrote a CS Module that allows you to enter code in a post and the dp.SyntaxHighlighter library will be used when the post is rendered.  The previous post here gives an example of all languages supported (Not anymore, since I quit using the js to highlight code, and started using Windows Live Writer).

I know that if you use FreeTextBox in CS then this functionality is already available, but I wanted to continue to use TinyMCE.

Download the module.

More Posts