Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a reason that cshtml isn't popular

Firstly, I have only recently tried my hand at building with razor in cshtml using Webmatrix and I found it much less time consuming than building aspx web forms. Having gotten used to it, I can now do all the things I used to do inside my aspx projects much quicker and with much less code...

Now, I've spent today looking around google etc at companies using cshtml, what they're using it for etc, but I can't find a large range of examples out there. Maybe I was just looking in the wrong place, rendering this question title incorrect, but I just had a feeling that there is a reason why companies are still using aspx over cshtml.

I'm about to start a project next month for a big client and I can't decide whether to take the step of building it this way (they need a custom blog, login area etc). Any thoughts? The only other stack thread I found of any use with regards to a debate was: Razor/CSHTML - Any Benefit over what we have?

Thanks,

Adam

like image 376
ASouthorn Avatar asked Sep 24 '12 18:09

ASouthorn


People also ask

Why is used in Cshtml?

This operator is useful in conjunction with other Razor server side operators when you want to output something as a literal text. For example: @if (model. Foo) { @:Some text to be written directly. }

What does the underscore on _layout Cshtml mean?

Layout pages are typically named _Layout. cshtml, the leading underscore preventing them from being browsed directly.

What are Razor expressions used for?

Razor provides expression encoding to avoid malicious code and security risks. In case, if user enters a malicious script as input, razor engine encode the script and render as HTML output.

What is Razor code?

Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages. Server-based code can create dynamic web content on the fly, while a web page is written to the browser.


1 Answers

A lot of it has to do with ASP (classic) has been around a lot longer and (depending the project size) a migration can incur too much cost.

There's also considerations like:

  1. What does the current web staff know (what are they fluent in?)
  2. What libraries (proprietary or otherwise) are already dependent on ASP (including custom controls).
  3. How much of an SEO hit are you going to take converting (some sites can mimic classic aspx page suffixes by just changing the way the routes behaving but are in-fact using cshtml).
like image 168
Brad Christie Avatar answered Oct 01 '22 01:10

Brad Christie