Routing in Asp.NET MVC is how ASP.NET MVC matches a URI to an action. ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users. It is a part of all the MVC versions but MVC 5 supports a new type of routing, called attribute routing. As the name implies, attribute routing uses attributes to define routes. Attribute routing gives you more control over the URIs in your web application. There is a separate article to understand Attributes in Routing in ASP.NET MVC.Continue Reading>>
ASP.NET Web API is a framework that allows us to build HTTP services that reach a broad range of clients, including browsers, mobile devices, and tablets. For creating RESTFul applications, ASP.NET Web API is an ideal platform on the .NET Framework. As it contains ASP.NET MVC features such as routing, controller, action results, filter, model binding, thus it is very easy to create application for ASP.NET WEB API. Here, one thing we should keep in mind that Asp.Net Web API is not a part of ASP.NET MVC. ASP.NET Web API is a part of code ASP.NET platform and it can be used with ASP.NET MVC or any other types of application or it can be a standalone service application.Continue Reading>>
ASP.NET MVC is one of the most popular frameworks for these days and the term “View Engine” is belongs to that. I this section we are try to understand about Razor View Engine and ASPX View Engine.
Introduction of View Engine
There are two types of view engine supported by ASP.NET MVC. In this Article we will go through the Razor and ASPX view engine View Engines are responsible for rendering the HTML from your views to the browser. The view engine template will have different syntax for implementation.
What is @Razor ?
Razor using an @ character instead of aspx's <% %> and Razor does not require you to explicitly close the code-block, this view engine is parsed intelligently by the run-time to determine what is a presentation element and what is a code element. Razor view engine is compatible with unit testing frameworks. This is the default view engine in MVC 3 and MVC 4. Web pages with Razor syntax have the special file extension cshtml (Razor with C#) or vbhtml (Razor with VB).
MVC is acronym of Model – View – Controller, is a software design pattern, which divide software application in to three major interconnected parts.
- Model- It is a class which is used to show or update view by using business logic. It is also used to validate user input. e.g. Employee, Student, etc.
- View – It is responsible to interact with users, it is the component that display the application to users. E.g. Textbox, Checkbox, etc.
- Controller- It is responsible to accept the request from the view, works with the model and select the view to render to display the User Interface (UI).Continue Reading>>
The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as membership-based authentication and master pages. The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace.Continue Reading>>
One of the most important purpose of server controls in ASP.NET —favoring HTMLlevel
code reuse. ASP.NET MVC doesn’t have the server controls but it have. To achieve these features in MVC, It needs be built programmatically based on dynamically discovered data. What’s a technology equivalent to server?
controls in ASP.NET MVC? Here comes the sense of HTML helpers.
HTML helpers certainly are not the same as server controls, but they are the closest you can get to HTML-level code reuse with a view engine. An HTML helper method has no view state, no postbacks, and no page life cycle and events. HTML helpers are simple HTML factories. Technically, an HTML helper is an extension method defined on a system class—the HtmlHelper class—that outputs an HTML string based on the provided input data. Internally, in fact, an HTML helper simply accumulates text into a StringBuilder object.
HTML helpers can be classified into three categories.Continue Reading>>