Solved

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

Posted on 2011-03-17
7
304 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
Comment Utility
familiar with vb.net?
0
 
LVL 4

Accepted Solution

by:
LeDaouk earned 250 total points
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:vstack
Comment Utility
Thanks, I will try the solutions and let you know.

I appreciate your efforts
0
 
LVL 4

Expert Comment

by:LeDaouk
Comment Utility
welcome
0
 

Expert Comment

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

Author Closing Comment

by:vstack
Comment Utility
Thanks both solutions meet my needs.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now