Forward slash become %2F

I have this endpoint which has one string parameter. When I tested the name payload with "a / b", it becomes "a %2F b". I put a breakpoint at the action method to see it. How do I prevent / to become %2F? What I expected is the value will be still the same "a / b". This is because there is a slash symbol in someone’s name. If possible, I don’t want to use the replace method.

    public async Task<ActionResult> UpdateName(int id, string name)
        // code is removed for brevity

>Solution :

I think you want something like UrlDecode ?

Leave a Reply