HttpHandler to format csharp, xml,, etc.

Today isn’t the best sunday in the Netherlands to enjoy the weather so that left me with the decision to do something usefull (like the household) or do some rainy sunday coding. I obviously choose the latter and that is the reason for this post.

I’m currently busy refining my home buildserver. Build results can be browsed as well as the sourcecode but the code didn’t get formatted. So wouldn’t it be handy if you have a HttpHandler that formats sourcecode like csharp,, xml (related) and html? So I started googling but could find one! So that left me with some work!

I based the HttpHandler on Manoli’s CSharpFormat class. There are three HttpHandlers available:

  • CSharpFormatHttpHandler
  • HtmlFormatHttpHandler
  • VisualBasicFormatHttpHandler

They resemble Manoli’s formatters if you didn’t noticed already….

You need to add Manoli’s CSharpFormat assembly and my Exyll.Web.HttpHandlers.Code assembly to you bin directory of you website. To make it all work you have to edit the web.config file and add the http handlers as shown in the web.config example Watch out that you don’t give access to your files that need to be secure!!!

After configuring all you need to do is test it! If everything works then you should see something like shown here.

Code formatter shown in action

Download the HttpHandler for csharp, xml and code formatting.
See an example web.config.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta