Tuesday, April 7, 2009

How to get output of one aspx page from another aspx page in asp.net using C# Code.

In Your aspx Page you.

using System.IO;
using System.Text;

(2).Use Server.Execute method.

protected void Page_Load(object sender, EventArgs e)
StringWriter strWriter = new StringWriter();
Server.Execute("~/Login.aspx", strWriter, false);
string str = strWriter.ToString();

variable str will contains Whole Html Output of Login.aspx page.