c# - 我是否需要在 WCF Web 服务中调用 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);
...
}
解决方案
推荐阅读
- mapstruct - 使用 List<> 的 List<> 在 mapstruct 上进行 @Mapping
- android - 导航到片段时应用程序崩溃
- laravel - Laravel Livewire 选择搜索下拉菜单不起作用
- xamarin.forms - Xamarin 表单中 CollectionView 的 VisualStateManager 问题
- spring-boot - 使用 Jetty 和 Jersey 在 Spring Boot 中提供静态内容
- javascript - 通过 id 替换 onedrive 中的现有文件内容(使用 onedrive api)正在替换为空大小的文件?
- javascript - 当查询返回错误时,React Admin parseResponse 不会触发
- php - WooCommerce 根据帐单地址字段更改更新运输方式
- vue.js - 深入了解自定义 UI
- .net - 如何在 .Net Core 5.0 的 windows 窗体中检索网络中的 SQL 服务器列表?