Skip to content

Instantly share code, notes, and snippets.

@pdwetz
Created March 19, 2013 02:34
Show Gist options
  • Save pdwetz/5193287 to your computer and use it in GitHub Desktop.
Save pdwetz/5193287 to your computer and use it in GitHub Desktop.
UrlFor() doesn't seem to be encoding forward slashes ("/") properly. The result of the following is "/alpha/1/abc/def%26ghi%3Djkl", but should have the forward slash encoded.
public class AlphaController
{
private readonly UrlRegistry _urlregistry;
public AlphaController(UrlRegistry urlreg)
{
_urlregistry = urlreg;
}
public string Get_Alpha_Id_Name(AlphaInputModel input)
{
return string.Format("Input: {0}", input.Name);
}
public string Get_Alpha()
{
return _urlregistry.UrlFor(new AlphaInputModel { Id = 1, Name = "abc/def&ghi=jkl" });
}
}
public class AlphaInputModel
{
public int Id { get; set; }
public string Name { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment