include asp page in webform

  • Thread starter Thread starter Dune
  • Start date Start date
D

Dune

I'm trying to migrate a page as quickly as possible from
asp to asp .net and was wondering if there is any way to
include an asp page in an aspx page? Basically, I'd like
to be able to do something equivalent to "<!-- #include
file="SomeFile.asp" -->" in a webform.

cheers :)
 
It is possible to "call" external web pages from asp.net, regardless of
whether those pages are in ASP.NET, PHP, CFM, JSP, ASP, or whatever. It's
all just
HTTP.

If the returned web page is formatted as XML, you can then parse the XML (or
deserialize it).
if it is HTML, you can display it or parse it,
etc.

It's up to you.

for a GET, you would do something like this:
string urlspec= "http://www.google.com";
System.Net.WebRequest req= System.Net.WebRequest.Create(urlspec);
System.IO.StreamReader sr = new
System.IO.StreamReader(req.GetResponse().GetResponseStream());
result= sr.ReadToEnd ();

The result would then hold the raw HTML. If you wanted to invoke a local
page, you could use http://localhost/aspdir/whatever.asp as your urlspec.

For a POST the code is somewhat different but the principle is the same.
 
Back
Top