473,786 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Someti mes 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.TextS tream
Dim mFso As New Scripting.FileS ystemObject
Dim s, s1, str1 As String

Dim Source As New System.Text.Str ingBuilder

Dim WebResponse As Net.WebResponse =
Net.WebRequest. Create(url).Get Response
Dim StreamReader As New IO.StreamReader
(WebResponse.Ge tResponseStream (),
System.Text.Enc oding.ASCII)

Do
Source.Append(S treamReader.Rea dLine() + vbCrLf)
Loop Until StreamReader.Re adLine() Is Nothing

StreamReader.Cl ose()

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

fsoStream = mFso.OpenTextFi le
(Application.St artupPath & "\example.t xt",
Scripting.IOMod e.ForWriting)

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

End Function

Nov 21 '05 #1
0 3107

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6150
by: Jonathan | last post by:
Calling the System.Net.WebResponse.GetResponse method (see code below) results in the following error: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. at(System.Net.HttpWebRequest.CheckFinalStatus()) at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at(System.Net.HttpWebRequest.GetResponse())
0
2766
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the idea that costs nothing and it is inheritently built into the Framework. So here is the solution... When you use the WebRequest and WebResponse classes to obtain graphics from a web site, these classes have built-in decoding for JPEG 2000 files....
2
9704
by: gizmo | last post by:
Hi, I'm using the following code to request the html source from the quoted site. ...... string url = "http://www1.soccerstand.com/"; WebRequest webRequest = WebRequest.Create(url); WebResponse webResponse = webRequest.GetResponse(); beginStr = new StreamReader(webResponse.GetResponseStream(),
2
1587
by: trialproduct2004 | last post by:
Hi all. i am having problem at a time of validatiang url. I am using webrequest and webresponse class to get content of particular url. My problem is after using webrequest and webresponse class i want to remove memory allocated by this object. am using close method and after that i am setting it to null. My pronlem is that at a time of setting webrequest to null sometimes it is taking more than 10 minutes. similary at a time of closing...
3
1648
by: trialproduct2004 | last post by:
hi all can some one tell me how to call dispose method of webresponse. I am currently using close method. But this is creating problem. So i want to use dispose method of webresponse. Can some one tell me how to do this. Any help will be appreciated. thanks in advance.
2
3390
by: Jeff G. | last post by:
Hello everyone, I have read through the newsgroups (thank God for 'em!) extensively looking for an example of how to pass a file (PDF) from a webresponse stream down to a web client. Here's the scenario - when the web browser requests a file, the IIS Server1 has to go back to Server2 to make a request for the file. Server2 then responds the file back to Server1 and Server1 should be able to just forward the file down to the web browser....
1
8207
by: Mr Flibble | last post by:
OK I logon to a web site and I manage to get an SMSESSION cookie that I then store in a variable called _session (a class scoping variable). I do this by calling a logon URL and setting a cookie to SMCHALLANGE=YES to allow me to obtain a session. I then iterate the cookie collection to extract the SMSESSION value. All is good (so far). This is when the sky turns grey and the rain starts to fall. I then use this SMSESSION in a web...
0
1506
by: archana | last post by:
Hi all, I am facing very strange problem while using webrequest. What i am doing is i have one url which i want to validate. so i am using webrequest and webresponse. My code is as below:- try {
3
2338
by: KyleUbenk | last post by:
Well I have a multi-threaded program which downloads URL sources from the web. Im doing this multiple times at once. The only problem I see is that sometimes it takes a while to download the sourceWebResponse ServerResponse = webrequest.GetResponse(); and only one webresponse can happen at once because the rest of the threads seem to wait on the first webresponse to finish. Is there a way around this? I hope you understand what my problem is. ...
4
2131
by: CindyH | last post by:
Hi - hope someone can help with this - this code was working for a while in the 'real' code and then suddenly stopped - not sure what happen. I made two simple forms on localhost to try to test what is going on. I'm not getting any errors right now, but code is not working either - not reading the post in second form or else the first form is not sending it correctly....
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.