Loop URL

D

Derek Hart

I have a 3rd party product that is called on a server with a URL. I will
have to run thousands of these URLs in a batch.

I will do this in winforms, perhaps in a Windows Service, running on the
server. Are there dotnet commands to loop through URLs, where I can run the
URL, then wait for its response, then run the next one... in a loop. I am
just unclear on the call to run the URL, and the waiting process.
 
D

Derek Hart

I may be answering my own question, but would like feedback. I have tried
this code. I am not sure if I need the oResponse variable, as I am not going
to evaluate a response. But if that is required, do I need to close the
response. Remember I just want to execute the URL... other things happen
elsewhere in the system if the URL does not work properly. So is the second
code block enough to just run through URLs? Of course each one would be
different, not www.google.com

Dim sURL As String
sURL = "http://www.google.com"
For i As Integer = 1 To 10
Dim oRequest As System.Net.HttpWebRequest =
System.Net.HttpWebRequest.Create(sURL)
oRequest.Method = System.Net.WebRequestMethods.Http.Get
Dim oResponse As System.Net.WebResponse =
oRequest.GetResponse()
oResponse.Close()
Next


Dim sURL As String
sURL = "http://www.google.com"
For i As Integer = 1 To 10
Dim oRequest As System.Net.HttpWebRequest =
System.Net.HttpWebRequest.Create(sURL)
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top