Webclient.DownloadString(url)不起作用 [英] Webclient.DownloadString(url) not working

查看:160
本文介绍了Webclient.DownloadString(url)不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,



我在我的应用程序中尝试使用Webclient.DownloadString(url),它始终给出操作已超时异常,而粘贴该URL则有效在浏览器中很好。



有人可以帮我解决问题。



谢谢

Vamsee

Hello Team,

I tried using Webclient.DownloadString(url) in my application which always gives "The Operation has timed out" exception whereas pasting that url works fine in browser.

Could someone help me in fixing the issue.

Thanks
Vamsee

推荐答案

您是否为Webclient设置了所需的标题?



请在下面查看链接...





http://stackoverflow.com/questions/19577586/webclient-downloadstring-not-returning-anything [ ^ ]



http://sta ckoverflow.com/questions/4716470/webclient-downloadstring-returns-string-with-peculiar-characters [ ^ ]



http://stackoverflow.com/questions/7137165/webclient-downloadstring-results-in -mangled-characters-due-to-encoding-issues-b [ ^ ]



并检查跨域策略



使用WebClient从ASP.NET Web服务错误中下载字符串 [ ^ ]
Have you set required headers to your Webclient?

please check below links...


http://stackoverflow.com/questions/19577586/webclient-downloadstring-not-returning-anything[^]

http://stackoverflow.com/questions/4716470/webclient-downloadstring-returns-string-with-peculiar-characters[^]

http://stackoverflow.com/questions/7137165/webclient-downloadstring-results-in-mangled-characters-due-to-encoding-issues-b[^]

and also check cross domain policy

Using WebClient to download string from ASP.NET Web Service Error[^]


public static void DownloadString (string address)
    {
        WebClient client = new WebClient ();
        string reply = client.DownloadString (address);

        Console.WriteLine (reply);
    }






这篇关于Webclient.DownloadString(url)不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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