12.07.2015 Views

October 2012 - Informatics

October 2012 - Informatics

October 2012 - Informatics

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Technology UpdateWEB PAGES WITH RAZOR SCRIPTINGNEW VIEW ENGINE IN ASP.NETRazor syntax is based ontechnology from Microsoftcalled ASP.NET, which inturn is based on Microsoft.NET Framework. TheRazor syntax gives you allpower of ASP.NET, butusing a simplified syntaxthat's easier to learn andit can be used withexisting ASP.NET Web Site.SANJAY GUPTAScientist-‘C’District <strong>Informatics</strong> OfficerJammusanjay.mahajan@nic.inEdited byMohan DasASP.NET is a Webapplication frameworkdeveloped by Microsoft toallow programmers tobuild dynamic Web sites and is successorto Microsoft's ASP technology.ASP.NET is built on CLR, allowingprogrammers to write ASP.NET codeusing any supported .NET language.ASP.NET supports three differentdevelopment methods. All three areASP.NET technologies for creatingdynamic web applications:n ASP.NET Web Pages focuses onadding server-side code and featuressimple and lightweight syntax.n ASP.NET Web Forms is based on apage object model. Web Forms usesevent-based model.n ASP.NET MVC implements Model-View-Controller pattern.In ASP.NET MVC3, Microsoftintroduced RAZOR, a new view engine,designed to simplify the current syntaxused in asp.net pages. Razor wasdesigned as an easy to learn, compactand expressive view engine that enablesa fluid coding workflow.ABOUT ASP.NET WEB PAGESWhen .NET Framework 1.0 wasreleased you could create web sites usingWeb Forms. It became a success andmany shifted from classic ASP and otherlanguages to ASP.NET.In web forms since the code weretightly coupled, it became hard to testcode as you had to have access to currentHttpContext and controls used by aspxfile. Because of this Microsoft releasedASP.NET MVC in 2007 and it solvedproblems by de-coupling the code andputting it to a controller, and have fullcontrol over rendering.There are though still a lot ofdevelopers who still use classic ASP,PHP etc style approach. Thesedevelopers want to have dynamic codeon server side, and sometimes also havebusiness logic directly in view pagessince it makes easy to distribute andmodify pages without need of compiling.Microsoft released third alternativecalled ASP.NET Web Pages. It makes itpossible to use new dynamic functions in.NET 4.0 and the rest of the .NETFramework as before. ASP.NET WebPages can be created using C# or VisualBasic, and requires .NET 4.0. Whencreating Web pages you use new syntaxcalled “Razor”.WHAT IS RAZOR?n Razor is markup syntax for addingserver-based code to web pagesn Razor has power of traditionalASP.NET markup, easier to learn andeasier to usen Razor is server side markup syntaxmuch like ASP and PHPn Razor supports C# and VBEven though this syntax is simple touse, its family relationship to ASP.NETand the .NET Framework means that asyour websites become moresophisticated. ASP.NET web pages withRazor syntax have the special fileextension cshtml (Razor using C#) orvbhtml (Razor using VB).25 | informatics.nic.in | <strong>October</strong> <strong>2012</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!