100 likes | 403 Views
Microsoft WebMatrix. Web applications using ASP.NET Razor Syntax. What is WebMatrix. WebMatrix is a web development tool from Microsoft Don’t confuse with ASP.NET WebMatrix (2003) WebMatrix is for light weight web applications Visual Studio is for ”heavy weight” web applications
E N D
Microsoft WebMatrix Web applications using ASP.NET Razor Syntax Microsoft WebMatrix
What is WebMatrix • WebMatrix is a web development tool from Microsoft • Don’t confuse with ASP.NET WebMatrix (2003) • WebMatrix is for light weight web applications • Visual Studio is for ”heavy weight” web applications • WebMatrix supports ASP.NET and PHP • WebMatrix supports many open frameworks, like • Jomla (Content Management System) • Umbraco (another CMS) • Drupal (yet another CMS) • Etc. Microsoft WebMatrix
Different file types ASP.NET Web form using ordinary C# ASP.NET Web Page using Razor Syntax Microsoft WebMatrix
Razor Syntax • Making ASP.NET web applications with WebMatrix you can use Razor Syntax • ASP.NET Razor Syntax is a part of ASP.NET MVC 3 • Inline coding in C# or VB.NET • No code behind as in ordinary ASP.NET • Further readings • http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax • http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx Microsoft WebMatrix
Razor is just another way of using the ASP.NET framework Figure from http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax Microsoft WebMatrix
Razor syntax, examplesfrom http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntaxand http://www.asp.net/webmatrix/tutorials/create-an-asp-net-website-from-scratch @{ var result = ""; if(IsPost) { result = "This page was posted using the Submit button."; } else { result = "This was the first request for this page."; }}<!DOCTYPE html><html> <head> <title></title> </head><body><form method="POST" action="" > <input type="Submit" name="Submit" value="Submit"/> <p>@result</p></form></body></html> </body></html> @{ var db=Database.Open("WebMatrixDemo"); var grid=new WebGrid(db.Query("SELECT * FROM Product ORDER BY Name")); } <!DOCTYPE html> <html> <head> <title>Products</title> <style type="text/css"> table {border-collapse: collapse;} td, th {border: solid 1px; } </style> </head> <body> <h1>Products</h1> @grid.GetHtml() </body> </html> Microsoft WebMatrix
IIS Express • Comes with WebMatrix • WebMatrix can run with ordinary IIS, but IIS Express is preferred • Development Environment • IIS Express • Should be more robust than ASP.NET Development server (bundled with Visual Studio) • http://visualstudiomagazine.com/articles/2011/01/19/iis-express.aspx Microsoft WebMatrix
SQL Server Compact • WebMatrix comes with SQL Server Compact • Embedded SQL Server Database Engine • Free to use and distribute • Filenames • DatabaseName.sdf • Further information • http://www.microsoft.com/sqlserver/en/us/editions/compact.aspx • http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx Microsoft WebMatrix
Further readings, etc. • MicroftWebMatrix • http://www.microsoft.com/web/webmatrix/ • Microsoft ASP.NET WebMatrix 1.0: Small, Simple, Seamless • http://www.asp.net/webmatrix • Scott Guthrie Introducing WebMatrix • http://weblogs.asp.net/scottgu/archive/2010/07/06/introducing-webmatrix.aspx • ASP.NET Introduction to ASP.NET Web Programming Using the Razor Syntax • http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax • Minfei Yan 10 minutes to understand ASP.NET Razor Syntax and WebMatrix • http://innovativesingapore.com/2010/10/razor-webmatrix-asp-net/ • Phil HaackRazor Syntax Quick Reference • http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx • MicrosoftWeb Development 101 using WebMatrix • Online book • http://www.microsoft.com/web/post/web-development-101-using-webmatrix Microsoft WebMatrix