在 ASP.NET MVC 中,可以使用 UrlDecode 方法对操作参数进行解码。以下是一个示例:
public ActionResult TestAction(string para) { string decodedPara = HttpUtility.UrlDecode(para); // 做别的事情 return View(); }
在这个示例中,TestAction 方法接受字符串类型的参数 para。在方法中,使用 HttpUtility.UrlDecode 方法对 para 进行解码,并将解码后的值赋给 decodedPara 变量。接下来,您可以根据需要使用 decodedPara 来完成其他操作。