Facebook page style urls in Asp.Net MVC
How would I write a route in Asp.Net mvc to handle a url like this one for a Facebook page:
http://graph.facebook.com/http://codedojoboise.开发者_StackOverflow中文版com/
I tried this route but get a 400 Bad Request error when I try to run it.
routes.MapRoute(
"LinkPreview",
"LinkPreview/{path}",
new {controller = "LinkPreview", action = "Get"});
The characters : and / are being treated like parameter separators and so the route isn't matching. Try LinkPreview/{*path} which will tell it to use all the following characters as part of the parameter.
Handling such characters in ASP.NET is a real PITA. You may checkout this or base64 encode it.
精彩评论