473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

HOw to get sourc from url

Hi,
I need to write C# component to extract html source from any url(iternte or
intranet)

Also I have been a pro C++ programmer. How dep can I go in C#. Is it equal,
less or more powerfull than C++ in terms of technicality and awareness of the
underlying layers

Kindly guide

Thanks
C# Pro
Nov 16 '05 #1
3 4445
Hi IceColdFire,

..Net has classes for communicating through http,
HttpWebRequest/HttpWebResponse.
To download the html source from a given url simply create a
HttpWebRequest object, and use its HttpWebResponse to get the stream for
the page.

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("http://www.utbnord.se");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string source = sr.ReadToEnd();

You might want to use the HttpWebResponse.ContentEncoding property, if
available, when creating the StreamReader.

As for how deep, I guess you could do it using the Tcp and Socket classes,
but I never tried it, nor am I familiar with how to do it in C++.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Thanks Morten...
It worked..

Also from where can I get IE Plugin coding details using C#..

Bye
ICF C#

"Morten Wennevik" wrote:
Hi IceColdFire,

..Net has classes for communicating through http,
HttpWebRequest/HttpWebResponse.
To download the html source from a given url simply create a
HttpWebRequest object, and use its HttpWebResponse to get the stream for
the page.

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("http://www.utbnord.se");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string source = sr.ReadToEnd();

You might want to use the HttpWebResponse.ContentEncoding property, if
available, when creating the StreamReader.

As for how deep, I guess you could do it using the Tcp and Socket classes,
but I never tried it, nor am I familiar with how to do it in C++.

--
Happy Coding!
Morten Wennevik [C# MVP]

Nov 16 '05 #3
On Sun, 12 Dec 2004 21:23:02 -0800, IceColdFire
<Ic*********@discussions.microsoft.com> wrote:
Thanks Morten...
It worked..

Also from where can I get IE Plugin coding details using C#..


I'm not sure I follow you. There is a Microsoft Web Browser COM object
you can use to display web pages in %windir%\system32\shdocvw.dll.

An couple of examples using this control:
http://www.c-sharpcorner.com/Interne...serInCSMDB.asp
http://www.codeproject.com/csharp/webbrowser.asp

However, this thread looks like it might be more relevant
http://www.dotnet247.com/247referenc...51/255003.aspx

Also, you might want to reask this question in a new thread.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #4

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

Similar topics

1
by: banjo123 | last post by:
Dear java.help: I just started learning java and was trying to compile some java sourc from the Javascript World Submission webpage. I know I have loaded m JDK successfully since I can compile...
134
by: Joseph Garvin | last post by:
As someone who learned C first, when I came to Python everytime I read about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(), getattr/setattr, the % operator, all of this was very...
1
by: Trent | last post by:
Hello, all. Does anyone know if IBMJava2-SDK-1.4.2-0.0 work with DB2 8.2? I tried it with DB2 8.2 and got some error. This server is a RH3ES with kernel 2.4.21.4...
2
by: Magix | last post by:
Hi, I have following code. char buffer; void string_addchar(char *sourc, char ch) { int length; length=strlen(sourc);
12
by: Magix | last post by:
Hi, Everytime I received a fix-length of string, let say 15 (the unused portion will filled with Spaces before receive), I want to remove the Spaces from END until I encounter a non-space char....
2
by: frazer | last post by:
hi i am looking at a colleagues code and i fail to understand what these mean. public event DataListItemEventHandler ItemSelect { add { this.Events.AddHandler(EventItemSelect, value); }...
5
by: Nathan Wiegman | last post by:
Using the XmlSerializer to deserialize a double.NaN value generates an exception in the framework which the framework then catches. This is super undesirable in our application, because our...
13
by: tovenkatesh82 | last post by:
Hi All, I want to copy some files from one dir in d:, to another dir in c:, i tried using xcopy but it says too many parameters!!pls give suggestions another thing i wanted to know is...
14
by: drsmooth | last post by:
I hope you are all ok with the frequency of this question following my last, im struggling alot with this database stuff. and i really appreciate all the help from this forum, many a time you have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.