我是否需要在WCF Web服务中调用URLDecode

时间:2018-05-31 15:20:15

标签: c# web-services wcf urldecode

我有一个用c#编写的WCF Web服务。我有一个像这样定义的Put方法:

[OperationContract]
[WebInvoke(Method = "PUT", UriTemplate = "MobileDevice?name={name}&make={make}&model={model}&serial={serial}&software={software}")]
MobileDeviceView RegisterMobileDevice(string name, string make, string model, string serial, string software);

在我的实现中,我是否需要为每个参数调用HttpUtility.UrlDecode(name);

public MobileDeviceView RegisterMobileDevice(string name, string make, string model, string serial, string software)
{
        string safeName = HttpUtility.UrlDecode(name);
        string safeMake = HttpUtility.UrlDecode(make);
        string safeModel = HttpUtility.UrlDecode(model);
        string safeSerial = HttpUtility.UrlDecode(serial);
        string safeSoftware = HttpUtility.UrlDecode(software);
        ...
}

0 个答案:

没有答案