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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

  • <%= 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.

Method 2

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

Method 3

  • <%= %> 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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x