I’m trying pass in a url as a paramter to my controller like this:
//Passed in via url like this: //http://www.mydomain.com/Puzzle/ContinuePuzzle/{insert url here} public ActionResult ContinuePuzzle(string url) { return View('PuzzleWrapper', (object)_PuzzleService.ContinuePuzzle(url); }
Whenever I try this I get a http 400 Bad Request error. I’ve tried UrlEncoding it, but it still doesn’t like it. Any suggestions?
I have a suspicion having two scheme declarations in the URL is causing the default route handler to throw the 400 response.
As a work around, I would just send the URL without the scheme (i.e. http://). I tested this scenario without any problems:
Using this route:
If you have to have the scheme, then use a querystring parameter like Charlino suggested.