-1

In JavaScript I encode part of uri:

var imageName = "test space in name of image.jpg"
var sentWithAjaxVariable = encodeURIComponent(imageName);
//sentWithAjaxVariable in console is "test%20space%20in%20name%20of%20image.jpeg"

On server side, in handler I want to decode this variable like this:

var imageName = context.Request.Params["sentWithAjaxVariable"];
var decodedImageName = context.Server.UrlDecode(imageName);
//decodedImageName in watch => "test%20space%20in%20name%20of%20image.jpeg"

why not decode?

abatishchev
  • 95,331
  • 80
  • 293
  • 426
Alex
  • 7,986
  • 27
  • 93
  • 150

1 Answers1

0

The method you're looking for is Uri.UnescapeDataString.

It's the respective .NET method for decodeURIComponent in JS.

Luizgrs
  • 4,595
  • 1
  • 19
  • 28