This is the code I use in the web.config:
<add name="MainRule" virtualUrl="^~/Pages/([\w-_]+).html"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/page.aspx?pid=${PageTitleToId.ConvertPageTitleToPageId($1)}"
ignoreCase="true" />
In the App_Code folder I have a “PageTitleToId.cs” class which contains the ConvertPageTitleToPageId function which takes a string parameter.
Am I missing something because the ConvertPageTitleToPageId function is not called when I run the page.
Any help is appreciated,
Simplecode
You can’t execute code in your web.config. I would update
page.aspxto handle atitlequery string parameter on which it callsConvertPageTitleToPageId()to get yourpid.