Update to SyntaxHighlighter Extension

by chris 7/14/2008 4:08:18 PM

After upgrading to BE 1.4.15 I noticed a javascript popped up on my site.  Looking futher into the errors it became clear the problem was related to the SyntaxHighlighter extension.  I did some digging and the root cause of the problem lies in the Javascript Handler built into BE.  I tried to follow what’s going on inside the StripWhitespace methods but soon ran out of patience.  I will post an issue on the BE issues page but for now I need things to work.  So after making some slight changes to the SyntaxHighlighter extension it is again ready for prime time. 

Specifically I changed the following line:

return Utils.RelativeWebRoot + "js.axd?path=" + Utils.RelativeWebRoot + url;

with the following syntax:

return Utils.RelativeWebRoot + HttpUtility.UrlEncode(url);

And that was all that is needed to get things working again.  I have previously mentioned that using web handlers is a better way to write code, but that only applies if things work.

One thing worth mentioning is that the SyntaxHighlighter JavaScript files are already compressed so the only real thing we are loosing out on by not using the JavaScript handler is the server side caching.  I will keep trying to figure out the issue with the JavaScript that is causing a problem with the web handler but for now just update your ~/App_Code/ExtensionsSyntaxHighlighter.cs file and you should be good to go.  Or you can just download the extension again and it will include the change.

Add comment


(Will show your Gravatar icon)  

biuquote
  • Comment
  • Preview
Loading




Powered by BlogEngine.NET Theme by Mads Kristensen Hosted by 1and1 Hosting Sign in
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. © 2008 Chris Blankenship

DSCODUC on Technorati  

Stop Spam Harvesters, Join Project Honey Pot   This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License  

Welcome to my blog

Welcome to my site

Villainy wears many masks,
none of which so dangerous as virtue…



LinkedIn   GeoURL

Recent Comments

Comment RSS

Wordle Gallery

Shelfari Book Library