I have a page that takes a URL parameter, matches it to a field in a list, and displays a different page for each list item.

I want the parameter values to be easy for humans to read. For this reason, I don't want them to have spaces in them. As well as using this to create the page through a URL parameter, the field is used to dynamically link to the generated pages.

However, I also need to have a field containing an unescaped version of the parameter for other purposes. So rather than enter two very similar values for each list item, I would rather enter one with spaces, and have the second generated dynamically.

A calculated column is theoretically one option. However SharePoint doesn't share Excel's SUBSTITUTE function, and using a REPLACE and SEARCH based equivilent can only replace the first few spaces because SharePoint has a nesting limit for functions.

I may be able to use the IIS URL Rewrite tool to solve this problem, but I'm not sure how. An important requirement is to have a way of pages being able to look up the address of a list item's page in that list.

I could use a unique ID that doesn't need escaping, but then the URLs would give less information to search engines.

What is the best practice for generating URLs for dynamicaly generated pages?

1 Answer 1


You could probably do this with a simple event receiver on the list, taking in the field with the spaces in and generated the text with the spaces swapped for dashes in the other field.

You'd probably need some code, via powershell or a command line app, to retrofit the current items in the list, though.

Here's some documentation on MSDN on creating List Item Event Receivers: http://msdn.microsoft.com/en-us/library/ms437502.aspx

  • This is what I would do as well
    – tarjeieo
    Jan 19, 2012 at 12:36
  • Thanks for the suggestion. It's bit beyond my current abilities, but it looks like I'm going to have to do this at some stage.
    – mcook
    Mar 5, 2012 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.