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

parse a web page in ASP using c#

I'm attempting to write a function that grabs a page from a web server and
reads it into either a string or a HTML or XML object that can be parsed to
retrieve the desired bits of data. My immediate use is in an ASP or ASP.NET
page, but I have a need for the same sort of functionality to automate the
population of a database.

I'm reasonably sure I can write the parsing, but it's the actual retrieving
of the web page that's my present roadblock. I'm sure that there's an object
and suite of functions to do this, I just can't seem to find them...

I would prefer to use c# as it's my language of choice at the moment;
however as my target platforms are all windows there can be a bit of leeway.

Sep 4 '07 #1
2 2132
Joseph,

You can use the WebClient class, or, if you need more control over the
download, the HttpWebRequest and HttpWebResponse classes.

If you are going to use an HTML parser, then that parser might already
have the capability to download the content from the web (the MSHTML parser,
for example, can do this).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Joseph Millman" <lo********@local.domainwrote in message
news:2B**********************************@microsof t.com...
I'm attempting to write a function that grabs a page from a web server and
reads it into either a string or a HTML or XML object that can be parsed
to retrieve the desired bits of data. My immediate use is in an ASP or
ASP.NET page, but I have a need for the same sort of functionality to
automate the population of a database.

I'm reasonably sure I can write the parsing, but it's the actual
retrieving of the web page that's my present roadblock. I'm sure that
there's an object and suite of functions to do this, I just can't seem to
find them...

I would prefer to use c# as it's my language of choice at the moment;
however as my target platforms are all windows there can be a bit of
leeway.

Sep 4 '07 #2
Hi,
"Joseph Millman" <lo********@local.domainwrote in message
news:2B**********************************@microsof t.com...
I'm attempting to write a function that grabs a page from a web server and
reads it into either a string or a HTML or XML object that can be parsed
to retrieve the desired bits of data. My immediate use is in an ASP or
ASP.NET page, but I have a need for the same sort of functionality to
automate the population of a database.

I'm reasonably sure I can write the parsing, but it's the actual
retrieving of the web page that's my present roadblock. I'm sure that
there's an object and suite of functions to do this, I just can't seem to
find them...

I would prefer to use c# as it's my language of choice at the moment;
however as my target platforms are all windows there can be a bit of
leeway.
Take a look at HttpWebRequest class.
Sep 4 '07 #3

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

Similar topics

2
by: John A. Irwin | last post by:
I'm very new to PHP and am trying to figure out how to parse out a variable "HTTP_REFERER". My reason for this is my site was recently "FEATURED" (sic) on a website called FARK.COM. Because of...
3
by: Mitchua | last post by:
When I run the well quoted line: my $ascii = HTML::FormatText->new->format(HTML::Parse::parse_html($html)); to remove HTML tags from an html document, it replaces all tables with "". Is there a...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
8
by: Spartanicus | last post by:
The document at http://homepage.ntlworld.com/spartanicus/custom_dtd.htm uses a custom DTD, the w3c validator validates it but with this warning: "Unknown Parse Mode! The MIME Media Type...
3
by: Kevin Kenny | last post by:
Dear All, I have a date time validation method thus: public static bool IsDate(string date, System.IFormatProvider provider) { try { DateTime.Parse(date, provider) return true; } catch...
1
by: Pupkin | last post by:
Hi, I was excited to use Microsoft Index Server, built into IIS, to set-up a site-search function, but it doesn't, by default, parse the ASP code of the pages it indexes. This makes it sort of a...
5
by: Moojjoo | last post by:
I am working on a Web application and when I try to add a Web Form with zero code on it and just type hello world I get the following: 1. The Virtual Web is setup as an application 2. All other...
5
by: js | last post by:
I have a textbox contains text in the format of "yyyy/MM/dd hh:mm:ss". I need to parse the text using System.DateTime.Parse() function with custom format. I got an error using the following code. ...
9
by: Bo Yang | last post by:
Hi, guys. I am now developing an application in which I need to fetch some html page, and then parsing it to get some intended content in it. Because HTML is not a standard XML format, so I am...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
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,...

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.