News
IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
Category - ASP.Net MVC Interview Questions
 
1. Explain MVC (Model-View-Controller) in general?
Ans:
MVC (Model-View-Controller) is an architectural software pattern that basically decouples various components of a web application. By using MVC pattern, we can develop applications that are more flexible to changes without affecting the other components of our application.
  • "Model" is basically domain data.
  • "View" is user interface to render domain data.
  • "Controller" translates user actions into appropriate operations performed on model.

2. What is ASP.NET MVC?
Ans:
ASP.NET MVC is a web development framework from Microsoft that is based on MVC (Model-View-Controller) architectural design pattern. Microsoft has streamlined the development of MVC based applications using ASP.NET MVC framework

Displaying AspDotNetMVC.png.

3. Explain the request flow in ASP.NET MVC framework?
Ans:
Request hits the controller coming from client. Controller plays its role and decides which model to use in order to serve the request. Further passing that model to view which then transforms the model and generate an appropriate response that is rendered to client.

Displaying AspDotNetMVC.png

4. What are the advantages of using Asp.Net MVC ?
Ans:
The main advantages of using Asp.Net MVC are as follows:
  • One of the main advantage is that it will be easier to manage the complexity as the application is divided into model,view and controller.
  • It gives us the full control over the behavior of an application as it does not use view state or server-based forms.
  • It provides better support for test-driven development (TDD).
  • You can design the application with a rich routing infrastructure as it uses a Front Controller pattern that processes Web application requests through a single controller.

5. Which namespace is used for ASP.NET MVC ?
Ans:
System.Web.Mvc namespace contains all the interfaces and classes which supports ASP.NET MVC framework for creating web applications.

6. What is the use of a Controller in ASP.NET MVC ?
Ans:
A controller will decide what to do and what to display in the view. It works as follows:
  • A request will be received by the controller
  • Basing on the request parameters, it will decide the requested activities
  • Basing on the request parameters, it will delegates the tasks to be performed
  • Then it will delegate the next view to be shown

7. What are the Core features of ASP.NET MVC?
Ans:
Core features of ASP.NET MVC framework are:
  • Clear separation of application concerns (Presentation and Business Logic)
  • An extensible and pluggable framework
  • Extensive support for ASP.NET Routing
  • Support for existing ASP.NET features

8. What is ViewData ?
Ans:
  • ViewData is used to pass data from controller to view
  • It is derived from ViewDataDictionary class
  • It is available for the current request only
  • Requires typecasting for complex data type and checks for null values to avoid error
  • If redirection occurs, then its value becomes Null
Example: 

		public ActionResult Index()
		{
    		ViewData["LoginName"] = "TheDeveloperTips";
    		return View();
		} 

9. What is ViewBag ?
Ans:
  • ViewBag is also used to pass data from the controller to the respective view
  • ViewBag is a dynamic property that takes advantage of the new dynamic features in C# .Net Framework 4.0
  • It is also available for the current request only
  • If redirection occurs, then its value becomes Null
  • Does not require typecasting for complex data type
Example: 

public ActionResult Index()
		 {
    		ViewBag.LoginName = "The Developer Tips";
    		return View();
		 }
To use in View:
		@ViewBag.LoginName 

10. What is TempData?
Ans:
  • TempData is derived from TempDataDictionary class and stored in short lives session
  • TempData is used to pass data from the current request to the next request
  • It keeps the information for the time of an HTTP Request. This means only from one page to another.
  • It helps to maintain the data when we move from one controller to another controller or from one action to another action
  • It requires typecasting for complex data type and checks for null values to avoid error. Generally, it is used to store only one time messages like the error messages and validation messages
Example:

		public ActionResult Index()
{  
     TempData["ModelName"] = model;
     return RedirectToAction("Product");
}

public ActionResult Product()
{
     var model= TempData["ModelName"];
     return View(model);
}

123
Search
Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: