Friday, April 22, 2011

What is relationship between WebMatrix, Razor, ASP.NET Web Pages and MVC?



WebMatrix: a stack and a tool


Let’s start with WebMatrix.  The term is actually used is two ways:
  1. The WebMatrix stack contains a number of things that you get when you install it via WebPI:
    • The new ASP.NET Web Pages framework
    • The Razor templating engine
    • The WebMatrix tool (see #2)
    • IIS Express
    • SQL CE 4
  2. The WebMatrix tool, which lets you perform various tasks:
    • Create web apps that use the Web Pages framework and the Razor templating engine
    • Install existing sites from the Web Gallery.  Note that those sites don’t have to use the Web Pages framework, and in fact most don’t (e.g. ScrewTurn wiki, Subtext)
    • Manage IIS express
    • Manage SQL CE 4 databases
Key point: the WebMatrix tool is not by any mean the only way to create Web Pages apps.  In fact, the Web Pages framework was designed to be very notepad friendly.  On the other end of the tooling spectrum, it will later be fully supported by Visual Studio.

Razor: a templating engine


At its root, Razor is just a templating engine, which is best compared to something like T4.  It is also comparable to the aspx and Spark engines.  The best way to describe it in its most general sense is:
  • It takes as input:
    • a template file (with a .cshtml or .vbhtml extension)
    • some input data: in web scenario, this includes things like an HTTP request, but this is not a requirement
  • It produces some output string: in web scenario, this is typically a piece of HTML that then gets sent as an HTTP response, but it could be anything.
So as an example, you could envision a very simple command line tool that would read an input file and some parameters, and write out the result of running the template on that input.  Note that everything I wrote here applies both to Razor and to something like T4.
Key point: Razor in itself is not tied to MVC nor to the Web Pages framework, and is not even really tied to web applications.
Note: check out Andrew Nurse’s blog for lots of technical details about Razor.

ASP.NET Web Pages: a simple framework to write ASP.NET web apps


WebMatrix introduces ASP.NET Web Pages, which gives users a simple and powerful new way of writing ASP.NET apps.  It is different from WebForms as it doesn’t use server controls.  It is also different from MVC as it doesn’t follow the MVC pattern.  Instead, it follows a much simpler ‘inline page’ model, where a page is basically an HTML page with some code added where needed.  In that sense, it is reminiscent of Classic ASP, but it is also very different in the sense that it has the full power of the .NET framework available behind it.  It also supports concepts like layout pages which make it much more flexible than the Classic ASP.
Where the discussion gets interesting is that the Web Pages framework uses Razor as its default templating engine.  However, it is not tied to Razor.  Potentially, you could use the aspx or Spark templating engines with the Web Pages framework.  At this point, we have mostly focused on using Razor with it, but it’s entirely conceivable that other templating engines would be supported later.
Key point: ASP.NET Web Pages uses Razor by default, but is not technically tied to it.

ASP.NET MVC


ASP.NET MVC is not part of the WebMatrix release, as it is a completely different framework with different goals (and this post is not about the pros and cons of the two, so I won’t go into that here!).  However, it ties into the story because the Razor templating engine will (soon) be made available as an MVC view engine.  As it should now be clear, this does not imply that you would be using ASP.NET Web Pages if you choose to use Razor as your MVC view engine.  All it means is that you’d be using the Razor syntax for your views instead of aspx (or Spark, …).  This has no bearing on how you write your controllers or other parts of your app.
Key point: Razor syntax will soon be available as an MVC view engine alternative


How WebMatrix, Razor, ASP.NET Web Pages and MVC fit together - Angle Bracket Percent - Site Home - MSDN Blogs

Generating RSS and ATOM Feeds In WebMatrix

Generating RSS and ATOM Feeds In WebMatrix

Asp.net MVC A-Z

Action:-Actions are like our general methods we are writing in C#,Controller can contain all actions which can send the response to the user or calling Views. Action(s) have return types ActionResult ii will return ViewResult for calling the View

Controller:-It is the Heart of Asp.net MVC, which take request for user and it will decide what view to render. It contain actions.
Model:-Model is like our normal .net component for write our business logic/validations etc.
View:-It is rednering User Interface, it contain 2 forms either .aspx(View) or .ascx(Partial View)
ViewEngineCollection:-It gives list of all register views


http://mvcframework.wordpress.com/2010/04/22/asp-net-mvc-a-z/

Thursday, April 21, 2011

8 useful sites for web developers

8 useful sites for web developers



Happy new year! 2011 is finally here. What about starting the new year with some absolutely awesome websites and tools to make your web developer life easier? I have compiled a must-read list for you.

Min.us: The easiest way to upload images


Any developer, designer or webmaster have to share images online with clients and co-workers. Min.us is an all new service that allow you to upload images extremely easily: Just drag and drop them into Min.us and the image will be saved on their servers. A short url will be automatically created so you can share it across the web.
» Visit Min.us

Wirify: Transform any web page into wireframes


Wireframes are extremely useful when designing a website. Wirify is a bookmarklet that allow you to instantly convert any web page into wireframes that you can study or use for your own work.
» Visit Wirify

CSS Resetr: View and compare CSS resets


CSS resets are a must have in any stylesheet in order to render differences between browsers. Since 2004, a lot of differents CSS resets has been published. So, which one is the best for your project? CSS Resetr let you compare the result of the most popular resets on a web page.
» Visit CSS Resetr

Head JS: Speed up your site with 2.30 kb of Javascript


Head JS is a simple and light (2.3 kb) script that will make your site faster by loading other scripts as images. Head JS can do a lot more to modernize your site: CSS3 support, dynamic CSS, etc.
» Visit http://headjs.com/

Copy Paste Character: Use special characters with ease


Special characters are often a pain to deal with, because they’re not on your keyboard, and because you don’t know the related ASCII code. Of course, you can grab an ASCII table and keep it on your desktop, or you can use a new service called Copy Paste Character: Simply click on the selected character to have it copied to your clipboard.
» Visit Copy Paste Character

DB Designr: Create database schemas online


Here is a very great tool to easily create database schemas online. No need to create an account, you can loggin using your Google account (Well, I guess any CWC reader have a Google account!)
» Visit DB Designr

Web 2 pdf convert: Convert any web page to PDF


Web2PDF Converter is a very useful tool that convert any webpage into a PDF file. It works great: I’ve converted 5 pages and all where the exact copy of the html version.
This very handy tool have more to offer: You can email an url and receive the PDF back. You can also add a bookmarklet to your browser for faster archiving.
» Visit web 2 pdf convert

Easily link your html page to your JS library


Are you tired of hunting the Internet in order to find the script tag for the latest version of the Javascript library of your choice? ScriptSrc.net has compiled all the latest versions of jQuery, Mootools, Prototype and more in a single page which lets you copy it in your browser clipboard with a single click.
» Visit ScriptSrc