Httpwebresponse - 我在json字符串前面附加回调。帮助我获得响应,而不在响应中添加回调文本 [英] Httpwebresponse - I am getting callback appended in front to the json string. Help me to get the response without the callback text prefixed in the response

查看:71
本文介绍了Httpwebresponse - 我在json字符串前面附加回调。帮助我获得响应,而不在响应中添加回调文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
string result1;
            
using (HttpWebResponse response1 = HttpWebResponse)webrequest.GetResponse())
{
    using (StreamReader reader = new StreamReader(response1.GetResponseStream()))
    {
        result1 = reader.ReadToEnd();  







Result1值低于。




The Result1 value is below.

Result1 = callback({"profileId":2924699,"dateCreated":"2019-03-07T21:05:02"});





我尝试了什么:



请帮助我在没有回调前缀的情况下获得回复。为了序列化json字符串



What I have tried:

Kindly help me to get response without callback prefixed. in order to serialize the json string

推荐答案

你已经请求了JSONP响应:

使用JSONP | Microsoft Docs [ ^ ]



您需要查看是否可以更改要求原始JSON响应的URL。请查阅您正在致电的服务的文档,或与提供服务的人员交谈。
You've requested a JSONP response:
Using JSONP | Microsoft Docs[^]

You'll need to see if you can change the URL you're calling to request a raw JSON response. Either consult the documentation for the service you're calling, or talk to the people who provide it.


如果您提出请求并将其取回,那就是您发送的内容。如果您知道有前缀而您无权访问服务器代码,请使用SubString将其删除
If you make a request and get that back, then that's what you were sent. If you know there's a prefix and you don't have access to the server code, use SubString to remove it


这篇关于Httpwebresponse - 我在json字符串前面附加回调。帮助我获得响应,而不在响应中添加回调文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆