如何将vbscript转换为c#.net控制台程序 [英] How to convert vbscript to c#.net console programm

查看:68
本文介绍了如何将vbscript转换为c#.net控制台程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要编写c#控制台程序,它与vbscript完全相同。



Need to write c# console programme which will do the exactly same thing as like vbscript.

set http = CreateObject("MSXML2.ServerXMLHTTP.4.0")
http.setTimeouts 5000, 5000, 10000, 3720000
http.open "GET", "http://nykpsm030000259.intranet.barcapint.com/SCP/CCL/Counterparty/ValidateCache", FALSE 
http.send ""
WScript.Echo http.responseText





接下来的步骤。 。



我的尝试:



HttpWebRequest http;

http =(HttpWebRequest)WebRequest.Create(http://nykpsm030000259.intranet.barcapint.com/SCP/CCL/Counterparty/ValidateCache);



Struck on next steps..

What I have tried:

HttpWebRequest http;
http = (HttpWebRequest)WebRequest.Create("http://nykpsm030000259.intranet.barcapint.com/SCP/CCL/Counterparty/ValidateCache");

推荐答案

使用WebRequest



WebRequest类(System.Net) [ ^ ]



鉴于您对此主题的多个其他主题,如果您遇到的问题是安全性或网络访问权限那么使用什么语言获取数据并不重要,许可总是被拒绝。
Use WebRequest

WebRequest Class (System.Net)[^]

Given your multiple other threads on this topic, if the issue you have is security or network access in general then it doesn't matter what language you use to get the data, the permission is always going to be denied.


除了解决方案1:



WebClient 的功能是基本的。用于加载HTTP资源的完整工具是类 System.Net.HttpWebRequest

HttpWebRequest Class(System.Net) [ ^ ]。



对于一个简单的完整代码示例,请查看我的HttpDownloader的完整源代码(只有一个文件):如何从互联网上下载文件 [ ^ ]。



-SA
In addition to Solution 1:

The features of the class WebClient are rudimentary. A full-fledged tool for loading HTTP resources is the class System.Net.HttpWebRequest:
HttpWebRequest Class (System.Net)[^].

For a simple fully-fledged code sample, please see full source code of my HttpDownloader (only one file): how to download a file from internet[^].

—SA


这篇关于如何将vbscript转换为c#.net控制台程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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