Ray said:
woops, forgot to mention. This is with ASP.net 1.1
Hi,
If i assume that you need to execute that page internally and get the ht
ml content, then it is very much possible. In the bottom of this reply
you can find and excerpt that calls the .aspx page using WebRequest
object and populates the html content into Div element.
In other way, if i assume that you want to execute the page just for the
sake of doing some process and with you need to pass some parameters
(means, you have to input some values) for the methods. Then, the only
way is to encapsulate the class that is inherited by the page from
another class and calling its methods to do so.
But, I suggest you should keep the code that needed to be "re-used" for
multi-purpose should be kept in different class and should be called in
appropriate places whenever needed.
Anyways, Let me know if this helps you or I am wrong in any case. And,
check the below code excerpt as well.
-
Vadive
-------
1. Create an ASPX page called "another_domain_info.aspx"
2. The below is the code that goes in the .aspx file
<body>
<form id="form1" runat="server">
<div id="yahooHtml" runat="Server"></div>
</form>
</body>
3. Now, in the another_domain_info.aspx.cs file create Page_Load event
and put the below code.
protected void Page_Load(object sender, EventArgs e)
{
WebRequest w = WebRequest.Create("
http://www.yahoo.com");
WebResponse wr = w.GetResponse();
StreamReader r = new StreamReader (wr.GetResponseStream());
String html = r.ReadToEnd();
HtmlGenericControl DivElement = this.FindControl("yahooHtml")
as HtmlGenericControl;
DivElement.InnerHtml = html;
r.Close();
wr.Close();
}
4. Now press F5 to execute this code. You can see yahoo's home page in
the aspx file.
Basically, what happens is WebRequest object request the given url and
gets the response coming back from the server. After getting the
response we are binding the response which is html data to the div tag
kept in the .aspx file.