How to generate and compile aspx pages dynamically
How Can I to generate and compile aspx pages dynamically.
Suppose I have a application testApp.
On one of its page I have a button GeneratePage and a TextBox For the Page Name.
and a checkbox for iscodebehind .
and a combobox for languages.
When I provide the desired information and then click generate button a new page will be generated and compiled
into the application.
(currently it doesn't matter what the content will be for this page)
I am looking for the solution in C#
[509 byte] By [
Kamii47] at [2008-2-7]
lol ... building your own asp.net development tool?
i think just generating the aspx, cs file and uploading them to server will do the job.
Thanks Nightmare I already know that we are not needed to recompile the application when we upload new file.As according to the new architecture when we run the application each page is compile into a single temprory dll then so on..
But What I like is to what function of .net are called when we create a add new item dialog box.
I know it uses C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\Web\CSharp\1033\WebForm.zip
Template in which there is a file WebForm.vstemplate which does all this thing of creating a webform.
But This hole process (that is which class is called which funtions are called e.t.c) is done I want's to find out that.
I know it is a little tuff thing but I thought some one could give me a clue.
u mean the functions used by the visual studio ide?
i dont think u need that if u want to generate your own pages and code files.
U can use the templates provided with visual studio (check the vs license to see if u are allowed to do that) or make your own.
i guess only thing vs does when creating a new page is getting the template and replace some strings in it (like pagename and stuff)
Thanks Nightmare.I have done that.It has solve my problem a little so that i have made my sample templated pages and user controls.
But as in custom code snippet we make some xml file with our required text and then in the code behind or other class files we simly add those text.I want to get same functionality for design or html view of the page.That is I want's made a xmlfile (like code snippet)for particular grid or particular type of table e.t.c then insert those in the same way as code snippet on the html view.
Could in any way I could do that ?