471,862 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,862 software developers and data experts.

webresponse in VB,NET

Hi

I have developed one application in VB.NET which extracts
the source code of Web pages.I gave a bunch of URLs in a
listbox while at the time of response from the web it was
struckup.Sometimes it gives output but sometimes it was
struckup,i don't know the reason why it was strucked.
If u know please let me know.Here it my source code.
Public Function GetSource(ByVal url As String) As String
Dim strURL As String
Dim fsoStream As Scripting.TextStream
Dim mFso As New Scripting.FileSystemObject
Dim s, s1, str1 As String

Dim Source As New System.Text.StringBuilder

Dim WebResponse As Net.WebResponse =
Net.WebRequest.Create(url).GetResponse
Dim StreamReader As New IO.StreamReader
(WebResponse.GetResponseStream(),
System.Text.Encoding.ASCII)

Do
Source.Append(StreamReader.ReadLine() + vbCrLf)
Loop Until StreamReader.ReadLine() Is Nothing

StreamReader.Close()

'Return Source.ToString()
TextBox2.Text = Source.ToString()

fsoStream = mFso.OpenTextFile
(Application.StartupPath & "\example.txt",
Scripting.IOMode.ForWriting)

fsoStream.Write(TextBox2.Text)
fsoStream.Close()
fsoStream = Nothing

End Function

Nov 21 '05 #1
0 3017

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jonathan | last post: by
2 posts views Thread by trialproduct2004 | last post: by
3 posts views Thread by trialproduct2004 | last post: by
2 posts views Thread by Jeff G. | last post: by
reply views Thread by archana | last post: by
4 posts views Thread by CindyH | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.