469,358 Members | 1,610 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

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 2958

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
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.