tags:

views:

45

answers:

1

Hi,

In DasBlog the template uses the following syntax, for example:

<h1><%= MyMacro() %></h1>

inside a txt file, and my query is, how this is evaluated at run time? Does the author of DasBlog use the AspCompiler programatically?

Is there an Evaluating statement I am missing or is the author simply using Regular Expression search and replaces? I doubt the latter but I need to ask regardless.

+1  A: 

The System.Web namespace contains methods to compile text like this. One way to do it, when you have the physical path, are:

    IHttpHandler pageInstance = PageParser.GetCompiledPageInstance(viewPath, physicalPath, HttpContext);
    pageInstance.ProcessRequest(HttpContext);
Thomas Eyde
Excellent thanks. I will have a go at that.
REA_ANDREW
I cannot vote you up yet either as my reputation is only 11 :-( Cheers again
REA_ANDREW