ASP.NET MVC Interview Questions Part - I Day 25

Lecture 25 : ASP.NET MVC Interview Questions Part - I

1) What is ASP.NET MVC ?
  • ASP.NET is A web application framework to develop website which can run on Map, Linux and any other platforms.

  • ASP.NET MVC is nothing but architecture pattern.

  • The MVC model also provides full control over HTML, CSS, and JavaScript.

  • The Model is the part of the application that handles the logic for the application data.(Has a business logic)

  • The View is the part of the application that handles the display of the data.(Has a look an feel UI)

  • The Controller is the part of the application that handles user interaction.(Connect the model on the view)

2) Why do we need Appsettings.json ?
  • The appsettings. json file is an application configuration so this configuration for example, configuration like connection string and version number, so all this are appsettings.json.

  • Appsettings.json file has parameter configuration.

3) What is JSON ?
  • JSON stands for JavaScript Object Notation. 

  • JSON is nothing but a format.

  • Example : "version" : "1.0.0"

  • It is a name value their format.

4) What kind of things go into wwwroot ?
  • The wwwroot  we store static files in your project go into this folder. 

  • These are assets that the app will serve directly to clients, including HTML files, CSS files, and JavaScript files.

  • The wwwroot folder is the root of your web sites.

  • wwwroot folder :


5) What does Program.cs ?
  • The Program.cs is application host.

  • Program.cs is the first file to run and what it does actually goes to server.

  • Like any application the execution of Application starts from public static void Main(string[] args){}

  • This Program. cs creates the application Host. 

6) What does ConfigureService and Configure in Startup.cs ?
  • The Startup.cs file is executed after program.cs file. 

  • The Startup.cs file is used for registering services and injection of modules in HTTP pipelines.

  • The Startup.cs contains the ConfigureService and Configure.

  • The ConfugureService method gets call before Configure method.

  • The ConfigureServices method is used to add services in DI(Dependency Injection) container. 

  • The Configure method is used to configure HTTP request and services.

7) How is the flow of MVC ?
  • The MVC is first hit come's to the controller and controller goes to the model and loads the data and put in the view and that's view is render then as HTML an the browser.

  1. User requests are intercepted by Controller whether it is a URL request or any event raised by the user on the page.
  2. Then controller processes the user input and talks to the Model.
  3. Model prepares data and sends back to the Controller.
  4. Finally, controller hands over data back to the view and is displayed to the user.
8) What are razor views ?
  • Razor is one of the view engines supported in ASP.NET MVC.

  • Razor view are those view in which we can write html and c# code.

Comments

Popular posts from this blog

Basic Concept In C Sharp Day 16

VS Code In JavaScript Day 6

ASP.NET MVC Interview Questions Part - II Day 26