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 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]
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] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
by: Magix |
last post by:
Hi,
I have following code.
char buffer;
void string_addchar(char *sourc, char ch)
{
int length;
length=strlen(sourc);
|
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....
|
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);
}...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |