1
Follows code:
var token = "bHhETtde1UhKpwUVmTsNTpXZKyfZGK8/";
var token_string = Uri.EscapeDataString(token); //"bHhETtde1UhKpwUVmTsNTpXZKyfZGK8%2F"
HttpResponseMessage response = await client.GetAsync($"{URL}/api/getall/{token_string}");
Apicontroller:
public async Task<IHttpActionResult> GetAll (string token) {}
In the parameter token, receives bHhETtde1UhKpwUVmTsNTpXZKyfZGK8 and lost the bar.
How do I not lose the "/" ?
Here are some examples of token:
- pj/Wgche1ujjqg8i/Mqas5zqgp3ob1rn
- Lk/lpohe1Ujjdftg+Guis5zqgp25b1rn
I use EscapeDataString because of the character +, /, among others.
Do not allow special string.
Some solution ?
It wouldn’t be the case if you remove the end bar and put it manually
getall/{token_string}/?– NoobSaibot
The problem is that the token can generate multiple bars.
– Matheus Miranda
Try to use the
Regex.Escape(string)– CypherPotato