473,396 Members | 1,914 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.

Reading html body through ASP.Net

How can I retrieve text from html file and write to textbox.

Best Regards,

Luqman
Nov 19 '05 #1
3 1870
Hello Luqman,

using (StreamReader rdr = new StreamReader("c:\path\to\my\file.html"))
{
string text = rdr.ReadToEnd();

// at this point, you have the text of the HTML file in a variable.
// do with it what you need to...
}

--
Matt Berther
http://www.mattberther.com
How can I retrieve text from html file and write to textbox.

Best Regards,

Luqman

Nov 19 '05 #2
From another site? Or from the local file system? Here's a method for
reading from another site:

<form id="form1" runat="server">
<asp:TextBox id="txtURI" runat="server" Width="552px"></asp:TextBox>
<asp:Button id="cmdSubmit" runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="txtHTML" runat="server" TextMode="MultiLine" Width="616px"
Height="552px"></asp:TextBox></P>
</form>

Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSubmit.Click
Dim oRequest As System.Net.WebRequest
Dim oResponse As System.Net.WebResponse
Dim oReader As System.IO.StreamReader
Dim sResponse As String
Try
oRequest = System.Net.WebRequest.Create(txtURI.Text)
oResponse = oRequest.GetResponse
oReader = New System.IO.StreamReader(oResponse.GetResponseStream )
sResponse = oReader.ReadToEnd
Catch : sResponse = "Could not load page"
End Try
txtHTML.Text = sResponse
End Sub

Ray at work

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
How can I retrieve text from html file and write to textbox.

Best Regards,

Luqman

Nov 19 '05 #3
Hi Ray,

Your code is returning Html source, but I need html Output in textbox or
rich text box. Whatever you see in the browser when you click on html file,
I want to display same in rich text box, so that formatted text
(bold/underline) could be displayed, html file could be on local computer or
could be anywhere in web site.

I want to use the html formatted text in my mailmerge application.

The user create a message in any software like outlook express, microsoft
outlook or frontpage and save it in html format. Then using my application,
he can send mailmerge messages using message body from html file.

I hope you understand what I mean.

Best Regards,

Luqman

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%2****************@tk2msftngp13.phx.gbl...
From another site? Or from the local file system? Here's a method for
reading from another site:

<form id="form1" runat="server">
<asp:TextBox id="txtURI" runat="server" Width="552px"></asp:TextBox>
<asp:Button id="cmdSubmit" runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="txtHTML" runat="server" TextMode="MultiLine"
Width="616px"
Height="552px"></asp:TextBox></P>
</form>

Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSubmit.Click
Dim oRequest As System.Net.WebRequest
Dim oResponse As System.Net.WebResponse
Dim oReader As System.IO.StreamReader
Dim sResponse As String
Try
oRequest = System.Net.WebRequest.Create(txtURI.Text)
oResponse = oRequest.GetResponse
oReader = New System.IO.StreamReader(oResponse.GetResponseStream )
sResponse = oReader.ReadToEnd
Catch : sResponse = "Could not load page"
End Try
txtHTML.Text = sResponse
End Sub

Ray at work

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
How can I retrieve text from html file and write to textbox.

Best Regards,

Luqman


Nov 19 '05 #4

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

Similar topics

5
by: Peter | last post by:
L.S. I am developing a PHP-login script (on Lycos Tripod) that uses Session to pass on variables. Below is the entire (stripped) structure that I use. It opens a page where you can Set and Read...
7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
1
by: Joel Goldstick | last post by:
I wanted to write a simple page to let me choose a directory and then list the files in it. The end goal was to make an easy way to copy all the file names in a directory. I tested with Opera7,...
6
by: Eddie | last post by:
When I use JavaScript to read an element's textDecoration style, I only get one value even if there are more than one in the sytle sheet. For example if the text-decoration is defined as:...
1
by: Cognizance | last post by:
Hi gang, I'm an ASP developer by trade, but I've had to create client side scripts with JavaScript many times in the past. Simple things, like validating form elements and such. Now I've been...
5
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button....
5
by: Just Me | last post by:
Does anyone have code or can point to usefull snippets to allow me to traverse the xml "Elements" of an xmlDocument. What I want to do is to move through the entire document and when I hit...
0
by: Hamayun Khan | last post by:
Salam Reading email from mailserver return some extra character like 3D =20 = following is the mail body i read from mailserver through php code <HTML><HEAD>
8
by: LayneMitch via WebmasterKB.com | last post by:
I'm supposed to develop a page that asks info as form values and when you hit "submit" it takes you to a page that reads the values you entered into the first page and displays those values in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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,...
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
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
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
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...

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.