<%$, <%@, <%=, <%# ... what's the deal?

asp.netServer Tags

asp.net Problem Overview


I've programmed in both classic ASP and ASP.NET, and I see different tags inside of the markup for server side code.

I've recently come across a good blog on MSDN that goes over the difference between:

  • <%= (percentage together with equals sign) and
  • <%# (percent sign and hash/pound/octothorpe)

(<%# is evaluated only at databind, and <%= is evaluated at render), but I also see:

  • <%$ (percent and dollar sign) and
  • <%@ (percent sign and at symbol).

I believe <%@ loads things like assemblies and perhaps <%$ loads things from config files? I'm not too sure.

I was just wondering if anyone could clarify all of this for me and possibly explain why it's important to create so many different tags that seemingly have a similar purpose?

asp.net Solutions


Solution 1 - asp.net

Solution 2 - asp.net

You've covered 2 of them (<%# is evaluated only at databind, and <%= is evaluated at render), and the answer for "<%@" is that it's compiler directives (ie., stuff like what you'd put on a compiler's command line).

I don't know about "<%$".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAaronView Question on Stackoverflow
Solution 1 - asp.netJose BasilioView Answer on Stackoverflow
Solution 2 - asp.netMichael BurrView Answer on Stackoverflow