views:

60

answers:

1

I've just upgraded my old wildcard mapping based URL system to use System.Web.Routing. Before, I was able to request the URL /Service/GetItems<My.Full.Item.Type>, which was parsed on the other side and returned exactly what you'd expect. That was neat.

Now with Routing on, any request with a < or > in it returns me the contents of '/' instead of the page I wanted. Even if I encode these to %3C and %3E I get redirected to the root, regardless of what the rest of the URL says.

I'd like it if I didn't have to go through my application changing all instances of intuitive generic references to the makeshift solution I've come up with: /Service/GetItems/T=My.Full.Item.Type. Not as nice, either.

Thanks all!

+2  A: 

It looks like you're running into the restricted characters problem with URLs. Note that this has nothing to do with Routing but with ASP.NET blocking certain characters within the URL.

Why did it work before with URL Rewriting? Most likely because the URL was rewritten to have those characters in the query string before it was handed off to ASP.NET.

There's some things you can try.

There's a registry setting to allow restricted characters http://support.microsoft.com/kb/820129

Here's another support article that's related: http://support.microsoft.com/default.aspx?scid=kb;EN-US;826437

In ASP.NET 4, we are planning to make this much easier to configure.

Haacked
Thanks so much for this answer, Phil! It's great to know the reasoning behind what's going on, and I'll look into these articles for a final solution. Thanks again.
tags2k