guisantogui
guisantogui

Reputation: 4126

Difference between special tags asp.net

I'm developing a front-end part of an application right now, and a question came to my mind.

What is the difference between asp.net special tags:

<%= %>
<%@ %>
<%# %>

And if exists another special tag please describe its function.

Upvotes: 2

Views: 1380

Answers (3)

Ajay
Ajay

Reputation: 2080

Check the below site Once..You will get an idea

http://naspinski.net/post/inline-aspnet-tags-sorting-them-all-out-(3c25242c-3c253d2c-3c252c-3c252c-etc).aspx

These are some useful special tags

Upvotes: 4

&#205;lson Bolzan
&#205;lson Bolzan

Reputation: 374

  • <%= %> Code Render Block - For evaluate inline expressions
  • <%@ %> Directive Syntax - Usualy for linking the codebehind and a asp.net page.
  • <%# %> Data binding

You can find more information at: http://msdn.microsoft.com/en-us/library/fy30at8h(v=vs.85).aspx

Upvotes: 1

SLaks
SLaks

Reputation: 887385

  • <%= prints the raw value of the expression within.
    This syntax can cause XSS vulnerabilities and should not be used.

  • <%: prints and HTML-escapes the value of the expression within.

  • <%# is like <%=, but is used for data-binding

  • <% executes a block of code and ignores and return values

  • <%@ is used for directives like Page or Imports.

Upvotes: 6

Related Questions