WebClient 远程服务器返回错误: (400) 错误的请求。 直接URL输入就可以,而写代码请求就这样
是通过WEB GET提交存数据到数据库里
直接URL上输入没有任何问题,而用WebClient请求 远程服务器返回错误: (400) 错误的请求
以下是参数GET请求,我直接URL上输入没任何问题,然后写个WebClient DownloadString 就报400错误和以
下链接一模一样。调试发现没有访问到api.ashx,而是直接DownloadString就报400错误了。。
换个其它英文字数却可以,大神们可以试下 以下参数 ,求解决 --!!!
http://localhost:27052/Api.ashx?name=admin&pwd=admin&acction=9&site=www.sdfa.com&content=%3CP%20align%3Dcenter%3E%3CIMG%20alt%3D%E9%98%BF%E8%81%94%E9%85%8B%E5%85%AC%E5%8F%B8%E6%98%8E%E5%B9%B42%E6%9C%88%E5%B0%86%E5%90%91%E4%BF%84%E5%86%9B%E6%8F%90%E4%BE%9B%E9%A6%96%E6%9E%B6%E2%80%9C%E8%81%94%E5%90%8840%E2%80%9D%20src%3D%22http%3A%2F%2Fimg1.gtimg.com%2Fnews%2Fpics%2Fhv1%2F75%2F123%2F1473%2F95813265.jpg%22%3E%3C%2FP%3E%3CP%20style%3D%22FONT-FAMILY%3A%20%E5%AE%8B%E4%BD%93%3B%20FONT-SIZE%3A%2010pt%22%20align%3Dcenter%3E%E8%B5%84%E6%96%99%E5%9B%BE%EF%BC%9A%E9%80%A0%E5%9E%8B%E5%A5%87%E7%89%B9%E7%9A%84%E8%81%94%E5%90%8840%E6%97%A0%E4%BA%BA%E6%9C%BA%3C%2FP%3E%3CP%20style%3D%22TEXT-INDENT%3A%202em%22%3E%E4%B8%AD%E6%96%B0%E7%BD%9112%E6%9C%883%E6%97%A5%E7%94%B5%E6%8D%AE%3Cspan%20class%3D%22infoMblog%22%3E%E4%BF%84%E6%96%B0%E7%A4%BE%3C%2Fa%3E%3C%2Fspan%3E%E6%8A%A5%E9%81%93%EF%BC%8C%E9%98%BF%E8%81%94%E9%85%8B%E6%97%A0%E4%BA%BA%E7%B3%BB%E7%BB%9F%E5%BC%80%E5%8F%91%E5%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%E6%96%AF-%E4%BB%A5%E8%89%B2%E5%88%97%E4%BA%A4%E6%98%93%E9%82%A3%E6%A0%B7%EF%BC%8C%E5%9C%A8%E9%A6%96%E6%89%B9%E8%B4%AD%E4%B9%B0%E4%B9%8B%E5%90%8E%EF%BC%8C%E5%8F%8C%E6%96%B9%E5%B0%86%E8%BE%BE%E6%88%90%E5%9C%A8%E4%BF%84%E7%BD%97%E6%96%AF%E7%94%9F%E4%BA%A7%E6%97%A0%E4%BA%BA%E6%9C%BA%E7%9A%84%E4%BA%A4%E6%98%93%E3%80%82%E2%80%9D%3C%2FP%3E%3CP%20style%3D%22TEXT-INDENT%3A%202em%22%3E%E6%8A%A5%E9%81%93%E9%80%8F%E9%9C%B2%EF%BC%8C%E4%BF%84%E7%BD%97%E6%96%AF2009%E5%B9%B4%E5%90%91%E4%BB%A5%E8%89%B2%E5%88%97%E8%88%AA%E5%A4%AA%E5%B7%A5%E4%B8%9A%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8(IAI)%E8%B4%AD%E4%B9%B0%E4%BA%8612%E6%9E%B6%E6%97%A0%E4%BA%BA%E6%9C%BA%26%238212%3B%26%238212%3B2%E6%9E%B6%E2%80%9C%E9%B8%9F%E7%9C%BC%E2%80%9D400%E6%97%A0%E4%BA%BA%E6%9C%BA%E3%80%818%E6%9E%B6I-View%20Mk150%E6%97%A0%E4%BA%BA%E6%9C%BA%E5%92%8C2%E6%9E%B6Searcher%20Mk.2%E6%97%A0%E4%BA%BA%E6%9C%BA%EF%BC%8C%E6%80%BB%E9%A2%9D5300%E4%B8%87%E7%BE%8E%E5%85%83%E3%80%82%E8%BF%99%E7%AC%94%E4%BA%A4%E6%98%93%E9%9A%8F%E5%90%8E%E9%81%AD%E5%88%B0%E8%AE%B8%E5%A4%9A%E6%89%B9%E8%AF%84%E3%80%82%3C%2FP%3E%3C%2Fdiv%3E&by=%E9%A3%9E%E9%B8%9F&yuan=%E6%9C%AC%E7%AB%99&title=%E9%98%BF%E8%81%94%E9%85%8B%E5%85%AC%E5%8F%B8%E6%98%8E%E5%B9%B4%E5%B0%86%E5%90%91%E4%BF%84%E5%86%9B%E6%8F%90%E4%BE%9B%E9%A6%96%E6%9E%B6%E5%A4%A7%E5%9E%8B%E6%97%A0%E4%BA%BA%E6%9C%BA
[解决办法]
忘记加user agent了吧
[解决办法]
用fiddler2比较下request有什么不同。