473,659 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1880
Hello Luqman,

using (StreamReader rdr = new StreamReader("c :\path\to\my\fi le.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="Multi Line" Width="616px"
Height="552px"> </asp:TextBox></P>
</form>

Private Sub cmdSubmit_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdSubmit.Click
Dim oRequest As System.Net.WebR equest
Dim oResponse As System.Net.WebR esponse
Dim oReader As System.IO.Strea mReader
Dim sResponse As String
Try
oRequest = System.Net.WebR equest.Create(t xtURI.Text)
oResponse = oRequest.GetRes ponse
oReader = New System.IO.Strea mReader(oRespon se.GetResponseS tream)
sResponse = oReader.ReadToE nd
Catch : sResponse = "Could not load page"
End Try
txtHTML.Text = sResponse
End Sub

Ray at work

"Luqman" <pe*******@cybe r.net.pk> wrote in message
news:eR******** ******@TK2MSFTN GP12.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******** ********@tk2msf tngp13.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="Multi Line"
Width="616px"
Height="552px"> </asp:TextBox></P>
</form>

Private Sub cmdSubmit_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdSubmit.Click
Dim oRequest As System.Net.WebR equest
Dim oResponse As System.Net.WebR esponse
Dim oReader As System.IO.Strea mReader
Dim sResponse As String
Try
oRequest = System.Net.WebR equest.Create(t xtURI.Text)
oResponse = oRequest.GetRes ponse
oReader = New System.IO.Strea mReader(oRespon se.GetResponseS tream)
sResponse = oReader.ReadToE nd
Catch : sResponse = "Could not load page"
End Try
txtHTML.Text = sResponse
End Sub

Ray at work

"Luqman" <pe*******@cybe r.net.pk> wrote in message
news:eR******** ******@TK2MSFTN GP12.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
6469
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 the session variable BUT ... It doesn't work!!! It seems that both set- and readlink open their own private session. How can I get the read-link to access the proper session variable?
7
7086
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 disadvantages of using a MySQL blob field rather than reading the images directly from the file? How does one insert an image into a blob field? Can it be done dynamically? Thank you John
1
5291
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, Mozilla 1.4 and IE6 -- all on windows XP Pro Here is the code. In all three, when I select a file, the complete path is displayed in the file input box. In Opera, reading the form field gives me the same full path. But in IE and Moz I get...
6
20504
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: text-decoration : underline overline; when reading element.currentStyle.textDecoration I only get "underline"!! What's worse is that element.style.textDecorationUnderline returns
1
2785
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 assigned the task of extracting content from a given HTML page. If anyone's familiar with the Yahoo! Store order confirmation screen, I need to be able to grab the total amount from the table to the right-hand side. (Sample File:
5
3725
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. When the user clicks the "Add another email" it will call a client side JavaScript function, add_email, which will dynamically add a new set of controls to the webpage using the innerHTML method. It appears to work perfectly fine in the browser. The...
5
1379
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 <table <tr <tdclear the attributes for these Elements and also remove all Elelments NOT nested inside a <table> I'm sure my head is going to explode soon :-( Cheers
0
1543
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
2056
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 message. I can't seem to find where I'm going wrong. Here's the code: Setting Cookie and Form Page: <html><head><title>Problem3</title> <script type="text/javascript" src="core.js"></script> <script type="text/javascript">
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
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
5649
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();...
1
2749
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 we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.