public void getContent() {
string VirtualPath = "~/Content.aspx";
var page = BuildManager.CreateInstanceFromVirtualPath( VirtualPath, typeof( Page ) ) as IHttpHandler;
page.ProcessRequest( HttpContext.Current );
}
I use this function to load contents from different files, but "page.ProcessRequest (HttpContext.Current)" inserts the contents into the current context, and I need a function that returns the contents of the specified file.
I wonder if there is a way to create a new HttpContext so that "page.ProcessRequest" does not contribute anything to the current response.
source
share