Posts

Showing posts from June, 2020

Routing in Asp.Net MVC with example

                       Routing in Asp.Net MVC with example           Routing is defined in the RegisterRoutes method inside the RouteConfig class.         this RouteConfig class resides in App_Start Folder.                public static void RegisterRoutes(RouteCollection routes)         {             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");             routes.MapRoute(                 name: "Default",                 url: "{controller}/{action}/{id}",                 defaults: new { controller = "Account", action = "Index", id = UrlParameter.Optional }             );           ...

ASP.NET MVC Architecture

Image
                             ASP.NET MVC Architecture  MVC is Model, View, and controller. it separates an application into three-part     1)Model 2) View 3) Controller.  Let understand each part in details below:-  1)  Model :-  Model represents data and business logic. it maintains the data of the application.                        we can create an object of the model and using that object we can store                        and retrieve data from the database        2)  View :- View is User interface means UI.                     View Display data using a model to users and enable them to modify data.    3)  Controller :- Controller is a request handler....

ASP.NET MVC Folder Structure

Image
                            ASP.NET MVC Folder Structure                                Hello, you will learn the folder structure of MVC . when we create a new MVC application it creates a default structure below:-                  Let Understand Folder                              1) App_Data :- This folder contains files like .mdf file  , XML file , localdb etc.               2) App_Start:- This folder contains files like a bundle.config.cs, filter.config.cs ,                                          RouteConfig.cs . this three file in MVC 5  include by default. ...

How To Create an MVC application in Visual Studio 2019

Image
                                     Below is a step to create an MVC project.    1) First, need visual studio so before creating MVC application first install Visual studio        https://visualstudio.microsoft.com/downloads/    you can install the latest version from the above URL.  2) Open Visual Studio 2019 and click on create a new project.       3)  After creating a new project. it showing multiple templates. you can choose any template       based on your requirement.                     1) Search ASP.NET in search box        2) Find ASP.NET Web application. if you want to develop an application in VB(visual basic)            then select VB  template if you want to develop an application in C#  ...

Non-Action Attribute in MVC

Image
                                         When you create an action method with public access modifier in the controller                       so you can access the method through URL from the browser.                       If you don't want to call a method through URL from browser then use nonaction                      attribute  in method                      Example:                                             public class LearnController: Controller                       {    ...