473,513 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get html to string

Hi all,

I want to have www.msdn.microsoft.com 's html code in a string ? What can i
do to have it?

Thanks.

Omer
Dec 23 '05 #1
3 15703
Hi,
You can create WebRequest passing Url and Get webResponse .
Get ResponseStream from WebResponse and read it into a String

Still if you have problem , let me know

ABCL

Dec 23 '05 #2
Hello ozulku_omer,

o> I want to have www.msdn.microsoft.com 's html code in a string ? What
o> can i do to have it?

// Address of URL
string URL = textBox1.Text;
try
{
// Get HTML data
WebClient client = new WebClient();
Stream data = client.OpenRead(URL);
StreamReader reader = new StreamReader(data);
string str = "";
str = reader.ReadLine();

while( str != null)
{
Console.WriteLine(str);
str = reader.ReadLine();
}
data.Close();
}
catch(WebException exp)
{
MessageBox.Show(exp.Message, "Exception");
}
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Dec 23 '05 #3
Hi Omer,

Here is the Code for converting HTml into string

string result = string.Empty;

WebRequest wrq = WebRequest.Create(Url);
WebResponse wrs = wrq.GetResponse();

StreamReader strdr = new StreamReader(wrs.GetResponseStream());
result = strdr.ReadToEnd();

strdr.Close();
wrs.Close();

Dec 24 '05 #4

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

Similar topics

4
3160
by: lkrubner | last post by:
I'd like to write a PHP script to be used from the command line on a Unix machine. I'd like for the script to put together a string, turn it into a web page, print it, then return control the...
2
8539
by: Dan Schumm | last post by:
I'm relatively new to regular expressions and was looking for some help on a problem that I need to solve. Basically, given an HTML string, I need to highlight certain words within the text of the...
10
3286
by: Wouter vanEck | last post by:
Hi, I need to find a way to read a html type string from a database and add it to a placeholder control on the page and then I need to be able to populate the fields that were in that html...
20
5594
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
2
2864
by: Tim_Mac | last post by:
hi, i have a tricky problem and my regex expertise has reached its limit. i have read other posts on this newsgroup that pull out the plain text from a html string, but that won't work for me...
3
2870
by: Just D. | last post by:
All, What's the simplest way to show my own HTML string on the ASPX page assuming that this page is just created using the wizard and it has nothing on it? We're free to use any control adding...
6
1810
by: Gabriella | last post by:
Hi, I have a textarea, where the user can enter any given string. He can also insert HTML tags, if he/she wishes. Once I obtain the textarea's string as HTML through form.body.innerHTML, I...
2
4579
by: csgraham74 | last post by:
Hi, I have a requirement in work that i give a person the ability to create a html document using a richt text editor. What i then want to do is save the HTML doct to my server & insert...
1
10644
by: eggie5 | last post by:
I want to use element.appendChild(child) on a string of HTML I have: html= '<div> <strong>Text</strong> </div>' However, since it's not an element (ie created with document.createElement)...
4
1375
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hello, I'm having issues with writing html string to a bookmark in MS Word 2007. I have a richtextbox control which returns HTML string, I would like to take that string and put it into a MS Word...
0
7260
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,...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5685
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,...
0
4746
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...
0
3233
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...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
456
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...

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.