screwturn wiki on .net 4 and extensionless urls

Screwturn wiki is (pretty) good software, but unfortunately seems to be mired in some of the older asp.net technologies. There are a LOT of moving parts under the hood, so trying to modernize it might be a challenge. I wanted to update it enough to run on .Net 4.0, and specifically to enable extensionless URL’s.. why have that silly ashx hanging off the end of each url nowdays? This has proven to be a bit of challenge due to the aformentioned many moving parts, so following is my current progress on this attempt-  the target website for this will remain nameless for now, to protect it from your prying eyes 😉

 

1. download the source version of screwturn

2. open it is visual studio 2010 and upgrade the project to .net 4.

3. when you try to compile, there’s a number of tests that fail and prevent compilation. they appear easy to fix, theyre all just parameter names that have changed, so update them to match.

4. compile and run the app. create a couple pages. notice when you go to the pages, they end in .ashx.

5. open the Core project, the Settings.cs file, and find the PageExtension propterty. edit it to return “” instead “.ashx”

6. open Core\ReverseFormatter.cs edit the Regex named PageLinkRegex to remove the \.ashx portion (verify this is needed)

7. open core\urltools.cs, RouteCurrentRequest() – change the line-

  if(ext != “ashx” && ext != “aspx”) return;

so that “ashx” is now “”

in the same method, find if(ext.Equals(“ashx”)) and change it to “”

 

It makes sense to remove the /MainPage url as well, since it is the same as / .

8. remove the static link to MainPage in /public/sidebar.cs, or just edit it out via the admin panel, find and edit the sidebar. any other places it shows up in static content can be edited this way.

9. dynamic links generated for the mainpage need to be fixed too. (I have not completed this yet, will update here when done. Add a comment if you find a quick way to do this)

 

x. You might need to backup the web.config and rename the web.release.config file to web.config instead, seems the 4.0 upgrade mixes things up a bit.

x. To enable .net 4.0, in the web.config, make sure the compilation tag has targetframework=”4.0″ and the provdierOption name=”CompilerVersion” = v4.0

x. Comment out (or delete) all the sectiongroups at the top of the web.config… these don’t like .net 4 for some reason.

x. enable “unsafe” posts of html – editing pages will blog up on save currently, due to XSS restrictions in 4.0.  Add requestValidationMode=”2.0″ to the httpRuntime tag in web.config

 

Many places in the web.config still reference 3.5 control versions, so I may try to upgrade some of these in the future, but things are running for now and that’s good enough.

 

 

Please add any feedback you have regarding this, thanks.  

 

Next episode: how to convert screwturn to mvc 3 and razor. I kid, i kid!