By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

How to code the HTTPWebrequest for a second URL

P: n/a
The code below between A> and B> serves to get a webpage from a URL.
My question is:
" What code do I have to add /change after B> in order to start a new web
request, say from URL2, using as many of the already Dim'ed objects?" I
tried many different things but to no avail.
Thank you.
'A>
Dim url, url2, webpage As String

Dim returnStream As Stream

Dim HttpWRqst As HttpWebRequest

Dim HttpWResp As HttpWebResponse

url = "http://moneycentral.msn.com/investor/srs/srsmain.asp?Symbol=IBM"

HttpWRqst = CType(WebRequest.Create(url), HttpWebRequest)

HttpWRqst.Accept = "*/*"

HttpWRqst.KeepAlive = True

HttpWRqst.UserAgent = ".NET Framework Test Client"

HttpWRqst.MaximumAutomaticRedirections = 20

HttpWRqst.MaximumResponseHeadersLength = 9999

HttpWResp = CType(HttpWRqst.GetResponse(), HttpWebResponse)

returnValue = HttpWResp.GetResponseStream()

Dim readstream As New StreamReader(returnStream,False)

WebPage = readstream.ReadToEnd

'B>
url = "http://moneycentral.msn.com/investor/srs/srsmain.asp?Symbol=F"
'C> What to code here reusing as many of the above objects as possible.
Apr 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.