This is almost certainly not The Way, but it is A Way:
string id = null; Match match = Regex.Match(Request.RawUrl, @"\?(?:[^&]*&)*id=([^&]+)"); if (match.Success) id = Server.UrlDecode(match.Groups.Value);
Someone with more insight into the id parameter handling is more than welcome to point out the right way to handle it.
Which version of EPiServer are you using? There is a bug in CMS 5 R2 SP2 which may be related, it also causes problems with non-FURLs. Maybe the id parameter would always be cut in your situation, but it will almost certainly be cut if you're using that version.
Thanks very much for getting back in touch guys!
Magnus, that is the version I'm using! Is there any way I can get around it? What's the bug specifically?
For me the problem was that when non-FURLs were requested from a FURL-enabled site, the pages always returned with my framework but void of content. The reason, it turned out, is that the ID parameter is removed by mistake at some stage in the http module chain, so the page template doesn't know which PageData to load the content from. If it is a FURL the URL rewriter puts the ID in the URL, at a later stage I presume, and it is not removed.
There is a hotfix for this non-FURL bug (or, so I've heard at least) available from EPiServer support.
Thanks for the tip Magnus, I'll contact support and find out if it's relevant!
My query is slightly removed from the 404 page redirection thread, so I'll keep this separate.
If I get IIS 6.0 to point to my custom error page, and then try to pick up the querystring, I get strange behaviour.
If I try to visit www.url.com/page.asp?param=paramval, my rawurl looks like this:
However, if I use this:
I get this:
The querystring parameter for id=paramval is cut off. I think it's because this is a reserved querystring parameter in EPiServer.
I MUST be able to get the id querystring val, and can't change what goes in. How can I get to it?
Thanks for any help!