473,383 Members | 1,862 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,383 software developers and data experts.

Get HTML Content of a Local Page

Sam
Hi All,

Is it possible to get a web page content of one of my webpages using
relative path?

for example:

If I have a website which consists of 2 pages: testpage1.aspx and
testpage2.aspx and the testpage2.aspx requires that I pass some parameters
to populate its form. Now if I want to get the html content of
"testpage2.aspx" page from testpage1's code behind page and store it in a
string variable, is it possible? I have been using HttpWebRequest and
HttpWebResponse objects to get the local page content but I just feel this a
bit awkward. Also the method "Create" of System.Net.WebRequest.class
requires a full url path to create a WebRequest object as in
System.Net.WebRequest.Create(url). Thanks in advance for your help.

Regards,

Sam
Nov 28 '06 #1
3 6609
WebRequest would have been my suggestion but you are already doing it.
Why do you need to retrieve the HTML from the page like this? What are
you doing with the HTML?

You can use a relative url if you pass it to the ResolveUrl function.
System.Net.WebRequest.Create(ResolveUrl(url))
Sam wrote:
Hi All,

Is it possible to get a web page content of one of my webpages using
relative path?

for example:

If I have a website which consists of 2 pages: testpage1.aspx and
testpage2.aspx and the testpage2.aspx requires that I pass some parameters
to populate its form. Now if I want to get the html content of
"testpage2.aspx" page from testpage1's code behind page and store it in a
string variable, is it possible? I have been using HttpWebRequest and
HttpWebResponse objects to get the local page content but I just feel this a
bit awkward. Also the method "Create" of System.Net.WebRequest.class
requires a full url path to create a WebRequest object as in
System.Net.WebRequest.Create(url). Thanks in advance for your help.

Regards,

Sam
Nov 28 '06 #2
Sam
Gozirra,

We have a page which allows users to print mulitple documents via popup
window at once by selecting checkbox beside them and the only way I can
think of right now is to have each of the pages' content saved to a string
and write to a popup
"Gozirra" <rm********@hotmail.comwrote in message
news:11*********************@80g2000cwy.googlegrou ps.com...
WebRequest would have been my suggestion but you are already doing it.
Why do you need to retrieve the HTML from the page like this? What are
you doing with the HTML?

You can use a relative url if you pass it to the ResolveUrl function.
System.Net.WebRequest.Create(ResolveUrl(url))
Sam wrote:
>Hi All,

Is it possible to get a web page content of one of my webpages using
relative path?

for example:

If I have a website which consists of 2 pages: testpage1.aspx and
testpage2.aspx and the testpage2.aspx requires that I pass some
parameters
to populate its form. Now if I want to get the html content of
"testpage2.aspx" page from testpage1's code behind page and store it in a
string variable, is it possible? I have been using HttpWebRequest and
HttpWebResponse objects to get the local page content but I just feel
this a
bit awkward. Also the method "Create" of System.Net.WebRequest.class
requires a full url path to create a WebRequest object as in
System.Net.WebRequest.Create(url). Thanks in advance for your help.

Regards,

Sam

Nov 28 '06 #3
I'd love to say that I have a great alternative solution for you but I
don't. I would have solved the problem in the same manner that you
are. I gave it some thought throughout the day and couldn't come up
with an alternative. As long as there are no performance problems or
any other issues, I believe the solution is pretty sound. Perhaps
someone else in the forums has a better suggestion.

Just to clarify, you are calling 1 - n different aspx pages in order to
retrieve the results for display and not static data correct? For
example, I want 2 reports for a given date range. The reports are
generated on the fly by 2 separate aspx pages. I call the pages with
the date parameters and the reports are generated on the fly. I
display the reports in the popup window after I append the results into
a single response.

Sam wrote:
Gozirra,

We have a page which allows users to print mulitple documents via popup
window at once by selecting checkbox beside them and the only way I can
think of right now is to have each of the pages' content saved to a string
and write to a popup
"Gozirra" <rm********@hotmail.comwrote in message
news:11*********************@80g2000cwy.googlegrou ps.com...
WebRequest would have been my suggestion but you are already doing it.
Why do you need to retrieve the HTML from the page like this? What are
you doing with the HTML?

You can use a relative url if you pass it to the ResolveUrl function.
System.Net.WebRequest.Create(ResolveUrl(url))
Sam wrote:
Hi All,

Is it possible to get a web page content of one of my webpages using
relative path?

for example:

If I have a website which consists of 2 pages: testpage1.aspx and
testpage2.aspx and the testpage2.aspx requires that I pass some
parameters
to populate its form. Now if I want to get the html content of
"testpage2.aspx" page from testpage1's code behind page and store it in a
string variable, is it possible? I have been using HttpWebRequest and
HttpWebResponse objects to get the local page content but I just feel
this a
bit awkward. Also the method "Create" of System.Net.WebRequest.class
requires a full url path to create a WebRequest object as in
System.Net.WebRequest.Create(url). Thanks in advance for your help.

Regards,

Sam
Nov 28 '06 #4

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

Similar topics

11
by: alex | last post by:
Hi, I am looking for a way to populate an HTML table from an external local text file which looks like this: DATE/TIME LAT. LON. DEPTH. ML....
4
by: Jim Rudnick | last post by:
I am generating a report in HTML, that my users can look over AND if they want to, store in their own Access dbase. Thing is, I do not know how to "read" that whole html page into a var and...
195
by: Torbjørn Pettersen | last post by:
As you might have noticed I'm trying to clean up my web site's HTML code. The way I do it is simply more or less redoing to complete site, testing it on a web server I have set up on my local...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
12
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
13
by: Ray Muforosky | last post by:
Hello all: Task: I want to do file search, using the "conatining text" option from a web page. How do I search for a file on my local drive containing a certain string, from a web page. That...
13
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.