Page p = new Page();

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

i will post on the bad ng... :

hello,
i want create a aspx object page for manipulate it.

like :
Page p = new Page();
p.LoadPage("~/mypage.aspx");
and after i can modify manually all control, header etc.. and save it.

how do ?

thancks
 
Steph said:
i will post on the bad ng... :

hello,
i want create a aspx object page for manipulate it.

like :
Page p = new Page();
p.LoadPage("~/mypage.aspx");
and after i can modify manually all control, header etc.. and save it.

how do ?

aspx isn't script like asp. The aspx ultimately compilies a class in to an
assembly.
It would be this class you would need to instantiate. However even that
would be useless without a HttpContext object to pass to it.

The only way to get a HttpContext object would be as part of a web server
request.
 
You can do this at the HTTP Handler level, but then you are essentially
rewriting the server. A better method would be to use the MVC pattern and
instantiate bits as you need them. There are plenty of articles on this type
of programming.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
hello,
in fact, it is a page aspx upload and just after getting the tmp file i
want "parse" all control for adding/removing Controls etc...


Page p = new Page();
p.LoadPage("~/mypage.aspx");
Label l = p.FindControl("foo") as Label;
....
 
Back
Top