I don't know how to use the razor code in my asp.net project. I am reading this tutorial w3school , but when i write the code in my "defaul.aspx" file then it can't run. can any one please tell me that how exactly to use the razor code in ASP.NET
- Did you install the razor packages from Nuget? Razor files end in something like .cshtmlBen Pretorius– Ben Pretorius2014-02-11 10:12:57 +00:00Commented Feb 11, 2014 at 10:12
- @BenPretorius NO, i have't installed that, even i don't know how to use the razor in asp.net, i am a bit new in asp.net, can you give some suggestion?Pir Fahim Shah– Pir Fahim Shah2014-02-11 10:14:16 +00:00Commented Feb 11, 2014 at 10:14
- 1You might as well start with this:) asp.net/mvcBen Pretorius– Ben Pretorius2014-02-11 10:16:01 +00:00Commented Feb 11, 2014 at 10:16
- @BenPretorius can we not use the razor code in ASP.NET WP model?Pir Fahim Shah– Pir Fahim Shah2014-02-11 10:19:19 +00:00Commented Feb 11, 2014 at 10:19
- 1You should be able to use it with ASP.NET. It is just a view engine that parse your views. The reason why it is not part of WebForms is the fact that it's core role is focused towards the MVC Pattern.Ben Pretorius– Ben Pretorius2014-02-11 10:21:57 +00:00Commented Feb 11, 2014 at 10:21
| Show 3 more comments
1 Answer
When you want to work with Razor in your asp.net Project, then you should create ".cshtml" file like Page.cshtml, write down all the code of Razor there. WebMatrix is a tool through which you can also create professional website of asp.net, and where you would have to handle the Razor. for further detail please see this liknk Razor in Asp.net