Home  >  Article  >  Backend Development  >  ASPX and Razor

ASPX and Razor

黄舟
黄舟Original
2017-02-23 09:48:242335browse

ASPX

The ASPX file is Microsoft’s server The dynamic web page file running on the client can be obtained after parsing and executing through IIS. The dynamic page is a new # introduced by Microsoft. ##Network programming method, rather than a simple upgrade of ASP, because its programming method is very different from ASP. It is compiled and executed on the server side by the server program code, ASP Using a script language, every time a request is made, the server calls the script parsing engine to parse and execute the program code. ASP.NET can be written in multiple languages ​​and is fully compiled and executed. It is faster than ASP, and not only It’s a matter of speed, which has many advantages. .asp is the file suffix of asp, .aspx is the file suffix of asp.net

Razor

## Razor is a simple programming syntax , used to embed server-side code in web pages. Razor The syntax is based on the ASP.NET framework, a component of Microsoft's .NET framework designed specifically for web application development. Razor syntax gives you all the power of ASP.NET, but with a simplified syntax that's easier to learn if you're a beginner and better for productivity if you're an expert. Razor web pages can be described as having two kinds of content HTML page: HTML content and Razor code. When the server reads this kind of page, it will first run the Razor code before sending the HTML page to the browser. These codes executed on the server can complete tasks that cannot be completed in the browser, such as accessing the server database. Server code can create dynamic HTML content before the page is sent to the browser. From a browser perspective, there is no difference between HTML generated by server code and static HTML content. use Razor syntax ASP.NET web pages have special file extensions cshtml (Razor syntax using C#) or vbhtml (Razor using VB).

Grammar difference

Summarize

Here is just a simple comparison, and we find that Razor is simpler than ASPX. Razor is used by ASP.NET MVC3 as a new view template. I also use Razor in my recent projects. What I use more often is to embed C# code in HTML pages, which is very convenient. The above summary is just my collection and understanding of online and other materials, and there are shortcomings. , please criticize and correct me.

The above is the content of ASPX and Razor. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Reflection and IOCNext article:Reflection and IOC