Solved

How can I read .html file in ASP.NET?

Posted on 2011-03-17
7
307 Views
Last Modified: 2012-05-11
Hello experts,

I run a debating club.  An external windows app software pushes out debate results in a table in a .html file.

Is there a way that I can read this table so that I can place the values of each field in a database?

I have attached a pic of the .html table. Table in HTML file
Thank you

Vince
0
Comment
Question by:vstack
7 Comments
 
LVL 4

Expert Comment

by:LeDaouk
ID: 35155418
familiar with vb.net?
0
 
LVL 4

Accepted Solution

by:
LeDaouk earned 250 total points
ID: 35155442
the code attached get the html tags to the string str
then you can manage it using mid(,,) function seraching for the html tag of each row
Dim web As New System.Net.WebClient()
            Dim url As String
            Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes("")
            Dim res As Byte()
            Dim str As String

url = "http://www.blablabla.com"
                res = web.UploadData(url, "POST", d)
                str = System.Text.Encoding.ASCII.GetString(res)

Open in new window

0
 
LVL 11

Assisted Solution

by:SAMIR BHOGAYTA
SAMIR BHOGAYTA earned 250 total points
ID: 35155661
Hi, use this code

Add main namespace for this operation

using System.IO;

Read html file


string file = Server.MapPath ("abc.html");
StreamReader sr;
FileInfo fi = new FileInfo(file);
string input = "<pre>";
if(File.Exists(file))
{
     sr = File.OpenText(file);
     input += Server.HtmlEncode(sr.ReadToEnd());
     sr.Close();
}
input += "</pre>";
Label1.Text = input;

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:vstack
ID: 35155923
Thanks, I will try the solutions and let you know.

I appreciate your efforts
0
 
LVL 4

Expert Comment

by:LeDaouk
ID: 35155932
welcome
0
 

Expert Comment

by:jayul
ID: 35163086
You have do it easily by using seprate tag <COL NAME>
0
 

Author Closing Comment

by:vstack
ID: 35164158
Thanks both solutions meet my needs.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question