How compile on fly cs file when they are stored in database

G

Guest

I should appeal to your experience to have a suggest as to solve my problem.

I have developed an application using .Net (1.1) where a handler (derived by
IHttpHandler) intercepts every web request beucase the files, formed the
page, are stored in a database.
No problem happens if the page is a pure html: in fact I fetch it from the
database and output it as reponse. If it contains an image (for example), a
new request is fired afterwards. However a problem happens if the page is
..aspx with a related code-behind file (the file .cs is, on its turn, stored
in the database).
In this case I suppose that I have to compile it on fly, but I don't know
the exact sequence of the operations to do.
Must I read the content of the .aspx file, parser the directive <%@ Page
src="..." %>, fetch the .cs file, save it on disk and compile it on fly..?
Have you a bit code as example to solve this drawback with elegance?.

I will be greatful to you for any suggestion forever.
Thanks and best regards.
Maurizio
 
G

Guest

Do a search for examples using Reflection.Emit(). This is the way to compile
code "on the fly" in .NET.

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

***************************
Think Outside the Box!
***************************
 
G

Guest

Hi Gregory

My problem is not to compile the file (for this also I can use
Microsoft.CSharp.CSharpCodeProvider class) but the sequence of the operations.
For example I suppose the compiled page must generate a dll and,
conseguently, I must request the aspx page again. But about this..I am not
sure.
Am I pioneer about this need ?.
Ciao
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top