简体   繁体   English

原始请求主体到字符串数组

[英]Raw request body to string array

I have the service code: 我有服务代码:

 [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "/BTNMetadata/", BodyStyle = WebMessageBodyStyle.WrappedResponse, ResponseFormat = WebMessageFormat.Json)]
    public List<BtnMetaData> BTNMetadata()
    {
        WebOperationContext.Current.OutgoingResponse.Headers.Add("Cache-Control", "no-cache, must-revalidate");
        WebOperationContext.Current.OutgoingResponse.Headers.Add("Expires", "Sat, 26 Jul 1997 05:00:00 GMT");
        var x= Encoding.UTF8.GetString(OperationContext.Current.RequestContext
                      .RequestMessage.GetBody<byte[]>());

But I found the returned x : 但是我发现了返回的x

x=%5B%228124318066%22%2C%223869383310%22%2C%229417395507%22%5D

What I want is: 我想要的是:

8124318066
3869383310
9417395507

Is there a .Net Framework encoding method to do it? 是否有.Net Framework编码方法?

Found an example. 找到一个例子。 Using HttpUtility.UrlDecode(). 使用HttpUtility.UrlDecode()。

var x = HttpUtility.UrlDecode("%5B%228124318066%22%2C%223869383310%22%2C%229417395507%22%5D");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM