What is the difference between Razor and ASPX?
Asked Answered
R

6

40

Is there any difference between Razor and ASPX in a MVC project?

Is it just about syntax? That's what I think after reading this... Am I wrong?

Recover answered 15/1, 2011 at 21:22 Comment(1)
look at this article's distinction tableSpoken
L
19

I guess it does boil down to that, yes.

As you can see from the examples in the article, the syntax is very lightweight and the interpreter is quite "smart".

You can compare it to the spark view engine and see the differences between the three.

Lemaceon answered 15/1, 2011 at 21:23 Comment(0)
I
24

It all boils down to syntax in your webpage view, but ASPX and Razor are pretty different view engines. Razor doesn't depend on the same pipeline that ASPX does. Because of that, I'd consider Razor to be just a parsing engine.

One of the advantages of that is that you can have a Razor parser run against any string, where aspx needs an httpcontext and other heavyweight elements.

Immodest answered 15/1, 2011 at 21:42 Comment(0)
L
19

I guess it does boil down to that, yes.

As you can see from the examples in the article, the syntax is very lightweight and the interpreter is quite "smart".

You can compare it to the spark view engine and see the differences between the three.

Lemaceon answered 15/1, 2011 at 21:23 Comment(0)
O
4

Razor is an alternative view engine for Asp.net MVC apps, and is implemented by entirely different code than .aspx. It's like the difference between JSP and Velocity in a Java MVC web app.

Osteopath answered 15/1, 2011 at 21:30 Comment(0)
C
4

razor support the test driven development.....while in the web engine having the system.web.ui .page class does not support TDD. test driven development means testing the code in a way before you writ it.

Cobweb answered 10/12, 2013 at 6:2 Comment(0)
D
1
  1. By default, Razor Engine prevents XSS attacks(Cross-Site Scripting Attacks) means it encodes the script or html tags like <,> before rendering to view.
  2. Razor Engine support TDD (Test Driven Development) since it is not depend on System.Web.UI.Page class.
Dashing answered 4/7, 2016 at 13:19 Comment(0)
S
0

In my opinion, I think Razor is Microsoft swinging around to scoop up all the classic ASP developers they left behind when they introduced .NET. The paradigm is very similar to ASP, server side code intermingled with client side html/js. An environment which is conducive, all over again, to the "spaghetti code" dilemma.

But for long time ASP developers, such as myself, it was the straightest route to a supported platform. And I retain the absolute control of the html/js that I am accustomed to.

Edit: BTW.... I am talking about Razor as used in .cshtml. I probably should have said that .cshtml is ms swinging around.

Snowslide answered 10/10, 2015 at 0:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.