Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get HTML Content of a Local Page

Reply
Thread Tools

Get HTML Content of a Local Page

 
 
Sam
Guest
Posts: n/a
 
      11-28-2006
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


 
Reply With Quote
 
 
 
 
Gozirra
Guest
Posts: n/a
 
      11-28-2006
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


 
Reply With Quote
 
 
 
 
Sam
Guest
Posts: n/a
 
      11-28-2006
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" <> wrote in message
news: 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

>



 
Reply With Quote
 
Gozirra
Guest
Posts: n/a
 
      11-28-2006
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" <> wrote in message
> news: 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

> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
document.getElementById(), error in content page content page Dave L ASP .Net 3 03-04-2010 08:50 AM
Setting the Page Title using local resources for a content page in a master page Laith Zraikat ASP .Net 3 07-06-2006 01:23 AM
Playing a local mpeg file from a local HTML file... Lyndon HTML 1 07-25-2005 02:21 AM
How to get the html output of a local JSP page from my Java code, or use a JSP as an HTML templates. DigitalUncle Java 0 11-02-2004 05:22 PM



Advertisments