Category «MVC»

Data Annotations in ASP.NET MVC Application

Data Annotation is one of the best approach to implement validation in ASP.Net MVC application. It’s depends on System.ComponentModel.DataAnnotations assembly and Data Annotation has a set of attributes and classes. public class EmployeeVM{ [Required(ErrorMessage = “The ID is required.”)] public int Id { get; set; }   [Required(ErrorMessage = “The name is required.”)] public string …

ASP.NET MVC : Model Binding

Model binding in MVC maps data from HTTP requests to action method parameters. The parameters may be simple types such as strings, integers, or floats, or they may be complex types. This is a great feature of MVC because mapping incoming data to a counterpart is an often repeated scenario, regardless of size or complexity …

Deploy an ASP.NET Core web app to Azure using Visual Studio

Sections: Set up the development environment Create a web app Test the app locally Deploy the app to Azure Set up the development environment Install the latest Azure SDK for Visual Studio 2015. The SDK installs Visual Studio 2015 if you don’t already have it. Note The SDK installation can take more than 30 minutes …

Introduction to ASP.NET Core

ASP.NET Core is a significant redesign of ASP.NET. This topic introduces the new concepts in ASP.NET Core and explains how they help you develop modern web apps. Sections: What is ASP.NET Core? Why build ASP.NET Core? Application anatomy Startup Services Middleware Servers Content root Web root Configuration Environments Build web UI and web APIs using …

ASP.Net MVC Folder Structure

Directory Purpose /Controllers Controller classes to handle URL requests /Models Classes that represent and manipulate data /Views UI template files that are responsible for rendering output /Scripts JavaScript library files and scripts /Content Non – dynamic/non – JavaScript content like CSS or Images /App_Data Data files you want to read/write  

What is Web farm ?

Web farm are the groups of shared servers to share the load of web requests. A single server usually handle all the web requests but when number of web requests increases on web servers then response become very slow. Web farms is the common way to handle such type of situation by using multiple servers where we …

Action Method Attributes in ASP.Net MVC

Action Filters Descriptions [Authorize] Restricts callers of the action [HandleError] Handling of an exception thrown by an action [OutputCache] Indicates that the output will be cached [ValidateAntiForgeryToken] Used to detect if someone is tampering with the request [ValidateInput] Used to validate input

Action Result Return Types in ASP.NET MVC

Action Result Helper Method Description ViewResult View Renders a view as a Web page. Example: • Return view for that action method: return View(); •Return a different view: return View(“ViewName”); PartialViewResult PartialView Renders a partial view, which defines a section of a view that can be rendered inside another view. RedirectResult Redirect Redirects to another …