如何通过httpwebrequest命中URL。 [英] how to hit URL through httpwebrequest .
本文介绍了如何通过httpwebrequest命中URL。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从下面的字符串中点击我的网址但在日志中却无法点击。
I want to hit my URL from the below string but in log it cannot hit.
Dim myReq As HttpWebRequest
Dim httpURL As New System.Uri("http://10.10.113.73:8080/PaymentGateway/merchantTranVerification.jsp")
I also use this code but not hit the URL.
Dim myReq As HttpWebRequest = WebRequest.Create("http://10.10.113.73:8080/PaymentGateway/merchantTranVerification.jsp")
任何人都给我httpwebrequest代码,用于点击URL或任何其他代码来点击URL。
请帮助我........
Anybody give me httpwebrequest code for hitting the URL or any other alternate code for hitting URL.
please help me........
推荐答案
看看这个:
MSDN:带示例的WebRequest类详细信息 [ ^ ]
其他样品:
CP虚荣 [ ^ ]
代码项目论坛分析器:了解多少你没有的生活! [ ^ ]
Have a look at this:
MSDN: WebRequest Class details with sample[^]
Other Samples:
CP Vanity[^]
The Code Project Forum Analyzer : Find out how much of a life you don't have![^]
请使用此
Response.Redirect("http://10.10.113.73:8080 / PaymentGateway / merchantTranVerification.jsp")
Please use this
Response.Redirect("http://10.10.113.73:8080/PaymentGateway/merchantTranVerification.jsp")
您知道,您正在使用本地网络IP,因此可能会限制您访问您尝试远程命中它的文件。什么是打击的意思?由于我不清楚你想要什么,我已经为你提供了一个C#示例StreamReader来从WebRequest读取文件。如果这是你想要的,请告诉我。无论哪种方式,它都会在示例中回答您的问题。
C#
Just so you are aware, that you are using a local networking IP thus probably restricting you from accessing that file you are trying to ' hit ' it remotely. What do you mean by hit? Since i am not clear on what you want, I've provided you a C# example of StreamReader to read the file from a WebRequest. Let me know if this is what you want or not. Either way, it answers your question in the examples.
C#
private void Main_Load(object sender, EventArgs e)
{
WebRequest request = WebRequest.Create("http://10.10.113.73:8080/PaymentGateway/merchantTranVerification.jsp");
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream iDataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(iDataStream);
string eresponse = reader.ReadToEnd();
MessageBox.Show(eresponse);
reader.Close();
iDataStream.Close();
response.Close();
}
.Net
.Net
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim inStream As StreamReader
Dim webRequest As WebRequest
Dim webresponse As WebResponse
webRequest = webRequest.Create("http://10.10.113.73:8080/PaymentGateway/merchantTranVerification.jsp")
webresponse = webRequest.GetResponse()
inStream = New StreamReader(webresponse.GetResponseStream())
Dim AvailCode As String = inStream.ReadToEnd()
MsgBox("AvailCode: " + AvailCode)
End Sub
这篇关于如何通过httpwebrequest命中URL。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文