TemplateRedirectionPage and ID as a Query String Key
We ran across an interesting issue today when using ID as a query string key for one of our custom web parts. Basically we have a RichHtmlField that pulls from a field that is defined in our base content type. In other words, there is a field that is defined on all of our page layouts. We then had a web part that expected a parameter of ID to do some work. Oddly, when we began passing in an ID the RichHtmlField began pulling in what looked like random content.
After looking into it a little more we realized that it was actually pulling the content from the list item with the specified ID in the query string. For instance, if we passed in 1 it would pull the content from whatever page happened to have an ID of 1. From the best I could gather it seems that the TemplateRedirectionPage translates the current request into a parameterized URL. It just so happens that it uses the ID key to determine what list item it should pull from the pages list. I tried to track it down for sure but hit obfuscation on the GetPathFromUrlValue within the TemplateRedirectionPage.
Although it is an easy fix, just change our query string key to something else, it was definitely one of the stranger ones I have seen. I hope in the future that they change this from a less commonly used key to something like _msID which would be much less likely to be used by external applications.
Labels: sharepont 2007