I'm passing values from a C# application to an ASP.NET MVC Web API that's been created. I've learned that when my value includes "\" like the the following:
{ id:"1", path:"D:\Backup\DataSource\MyFile.txt", name:"test" }
that the parameter in MyAction is null.
[HttpPost]
public CustomResponse MyAction(CustomEntity entity)
{
... // do stuff
}
public class CustomEntity
{
public string id { get; set; }
public string path { get; set; }
public string name { get; set; }
}
If the path does NOT include "\" everything works as intended. I'm guessing this is some type of encoding issue. However, I'm not sure what kind of encoding I need to use before I send the values from my C# app to the Web API.
What kind of encoding do I need to use?