Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between <%: and <%= in ASP.NET MVC?

I can't find this info anywhere. Probably because Google is ignoring the keywords. Is there a difference between using <%: and <%= in your aspx page? They seem interchangeable.

like image 545
Chris Stephens Avatar asked Jul 29 '10 21:07

Chris Stephens


People also ask

What is difference between ASP.NET MVC and core MVC?

ASP.NET Core is a Cloud environment for development and deployments. The primary difference between ASP.NET MVC and ASP.NET Core is their cross-platform approach. ASP.NET Core can be used on Windows, Mac, or Linux, whereas ASP.NET MVC can only be used for applications on Windows.

What is difference between ASP.NET webform and ASP.NET MVC?

Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access. Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development. Hence it is best for developing an interactive web application with the latest web standards.

What is the difference between .NET core and .NET core MVC?

The major difference in the project structure is that Asp.Net Core projects do not contain any web. config file like Asp.Net MVC projects. So, then question arise that however, the applying deals with completely different configuration settings like authentication or application low-level formatting specific code etc.

What is the difference between web API and MVC?

Web. Http” assembly has all features of MVC but does not have routing, and model binding which are exclusive to Web API. MVC does not either support content negotiation or self-hosting. MVC controller is extremely heavy and we can see the number of interfaces the code uses.


1 Answers

<%: %> is a new thing in ASP.NET MVC 2. It is the same as <%= Html.Encode("Text") %>. It is recommended to always use <%: %> unless you have some specific reason to not do so (for example, you are rendering data from some file or database that's already been encoded).

like image 185
ntcolonel Avatar answered Sep 18 '22 07:09

ntcolonel