Last post Jan 29, 2014 01:52 PM by DoctorWho
Jan 28, 2014 06:45 PM|DoctorWho|LINK
I'm learning the Razor syntax and so started with the
Introduction to ASP.NET Web Programming Using the Razor Syntax (C#) here on this site. One thing I'd like to clear up, is the Razor syntax only supported in .cshtml or .vbhtml files? It's not supported in .aspx files?
Jan 28, 2014 07:02 PM|Rion Williams|LINK
According to this Stack Overflow response from a former member of the ASP.NET Team (at that time) had the following response :
We (the ASP.NET team) currently have no plans to support the WebForms page model using Razor syntax. Furthermore it is unlikely that we would ever seriously consider this as the models are too different to make the two work together.
So currently and for the foreseeable future, it looks like Razor will be restricted to the mentioned .CSHTML and .VBHTML file types (outside of any third-party extensions that might implement it).
Jan 28, 2014 07:12 PM|DoctorWho|LINK
Thank you, Rion.
So, if I may, I'd like to do a follow-up question. How about other server side controls (e.g.: SqlDataSource, FileView, etc.) that are supported in .aspx pages. Are they supported in .cshtml and .vbhtml pages?
Jan 28, 2014 08:08 PM|Rion Williams|LINK
I don't believe that you can use Web Forms Controls at all within a Razor View (even if you configure your application to work with both environments). The fact is that Web Controls simply rely too heavily on the use of state among other things
that do not exist within the Razor View engine.
Scott Hanselman has an excellent blog post that covers mixing and matching Razor and Web Forms elements that you might want to skim through as it covers
some of the details of using the two within the same project.
Jan 28, 2014 09:08 PM|dblaire|LINK
Another link that I found interesting is:
Jan 29, 2014 01:38 PM|DoctorWho|LINK
Thank you very much, Rion, you've been very helpful. I'll check out Scott Hanselman's blog entry as well.
Jan 29, 2014 01:52 PM|DoctorWho|LINK
Thank you, dblaire, this is useful as well.