Macro in ASP.NET

Published 20 February 04 06:36 PM | despos

Quick (and non-scientific) poll. How do you feel about sort of ASP.NET macros? What's that?

My definition of ASP.NET macro is some markup text that is detected and expanded before the whole ASPX source is passed to the runtime for compilation. For example:

<dino:header title="Hello">

expanded to pure HTML (of course...)

<TABLE width="100%">
<TR> <TD>Hello</TD> </TR>
</TABLE>

Is it a far-fetched idea? Uhm, not sure. I've just seen a couple of posts to the public ASP.NET newsgroup. I'm not alone...

Comments

# Karl said on February 20, 2004 01:11 PM:

Can't you use SSI for this?

# Doug King said on February 20, 2004 01:11 PM:

I beleive this is how the Iron Speed code generation app works.
http://www.ironspeed.com

# Robert Taylor said on February 20, 2004 01:28 PM:

So, would this be a sort of WebControl that would be rendered at Compile-Time by some pre-processor? I don't see that it provides much more benefit over actually writing a WebControl to render at Run-Time.

# Paul Schaeflein said on February 20, 2004 01:38 PM:

This is how FrontPage components work...

# Kevin Dente said on February 20, 2004 02:20 PM:

After being forced to debug through some heinous C++ code riddled with macros a couple of years ago, I'm just as happy to not have them.

# Shannon J Hager said on February 20, 2004 02:38 PM:

Looks like a User Control to me.

# AndrewSeven said on February 20, 2004 02:41 PM:

How is that different from a control? Apart from the lack of a close tag :P


In the specific case, wouldn't it be better to use <H1>Hello</H1> and use some css?

I'm very interested in enabling designers (people) with better design time support I have a ton of opinions and ideas about it, but I haven't blogged about it yet.


# MartinJ said on February 20, 2004 05:51 PM:

How is it different than a control? What's different between #IFDEF SOMETHING and if something {}?

Instead of wasting CPU cycles on every request to determine if something needs to be done, you only waste the time once at page compilation.

I could see uses for it. Such as, a lot of information that is mostly static (the title of a page, for instance) could benefit by this. Instead of generating HTML on every request using code, you'd have just a single blob of static text in the runtime engine's eyes. It would cut down on the length of time rendering a request

-Martin

# Michael Teper said on February 20, 2004 07:11 PM:

Smells like a control to me too.

# olesja said on February 2, 2008 02:06 AM:

<a href= http://index1.greathal.com >pre teen pageant gown</a>

# Kangkan said on April 30, 2008 06:29 AM:

See the coding for dasBlog. Its simply impressive and contain much more than what you are thinking here.

http://www.geekays.net/ is built on dasBlog.

Regards,

Kangkan

http://www.geekays.net/

Leave a Comment

(required) 
(required) 
(optional)
(required)