Click to rate this post!
[Total: 0 Average: 0]

Dot Net Interview Questions and Answers

1)What are the types of Authentication in ASP.NET?

There are three types of authentication available in ASP.NET:

  • Windows Authentication:This authentication method uses built-in windows security features to authenticate user.
  • Forms Authentication:authenticate against a customized list of users or users in a database.
  • Passport Authentication:validates against Microsoft Passport service which is basically a centralized authentication service.

2)What are Session state modes in ASP.NET?

ASP.NET supports different session state storage options:

  • In-Processis the default approach. It stores session state locally on same web server memory where the application is running.
  • StateServermode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
  • SQLServermode stores session state in SQL Server database. It has the same advantages as that of StateServer.
  • Custommodes allows to define our custom storage provider.
  • Offmode disables session storage.

3)What are web services? What are the features of web services?

Web services are open standard (XML, SOAP, HTTP etc.) based Web applications that interact with other web applications for the purpose of exchanging data. Web Services can convert your existing applications into Web-applications.

Following are the features of Web service −

  • It is available over the Internet or private (intranet) networks.
  • It uses a standardized XML messaging system.
  • It is not tied to any one operating system or programming language.
  • It is self-describing via a common XML grammar.
  • It is discoverable via a simple find mechanism.

4)Give me an example of real web service?

  • One example of web services is IBM Web Services browser. You can get it from IBM Alphaworks site. This browser shows various demos related to web services. Basically web services can be used with the help of SOAP, WSDL, and UDDI . All these, provide a plug-and-play interface for using web services such as stock-quote service, a traffic-report service,  weather service etc.

 5)Differentiate between a SOA and a Web service?

SOA is a design and architecture to implement other services. SOA can be easily implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP, RPC etc. While Web service, itself is an implemented technology. In fact one can implement SOA using the web service.

6) Can you tell few benefits of web services?

The biggest advantage of web service is that is supported by wide variety of platforms. Moreover, in near future, web services may spread its boundary and enhance new methods that will provide ease to clients. The enhancement will not affect the clients, even if they offer old methods and parameters.

7) Explain what is ADO.NET entity framework?

 ADO.NET entity framework is an ORM (Object Relational Mapping) framework developed by Microsoft. It is an extension of ADO.NET that provides an automated mechanism to access and store data in the database. With the help of ADO.NET, database can be accessed without much required programming or code.

    8)Mention in what all scenarios Entity Framework can be applicable?

Entity Framework can be applicable in three scenarios

  • If you have existing database already or you want to build your database first than other parts of the application
  • If your prime focus is your domain classes and then create the database from your domain classes
  • If you want to design your database schema on the visual designer and create the classes and database

9) Explain what does .edmx file contains?

.edmx file is an XML file, which declares a conceptual model, a storage model and the mapping between these models.  This file also consists the information that is used by ADO.NET entity data model designer to render a model graphically. It consists of all the mapping details of how object maps with SQL tables.  It is divided into three categories SSDL, CSDL, and MSL.

 10) Mention what is the difference between LINQ to SQL and Entity Framework?

                            LINQ to SQL                         Entity
·          It works only with SQL Server Database

·          To maintain the relation it generates a .dbml

·          It cannot generate database from model

·          It permits one to one mapping between the entity classes and relational views/tables

·          It enables you to query data using DataContext

·          It provides tightly coupled approach

·           It works with various database like DB2, MYSQL, SQL Server etc.

·          It creates an .edmx files initially and relation is maintained using 3 different files .msl, .csdl and .ssdl

·          It can generate database from model

·          Between the entity classes and relational tables, it permits one-to-one, one-to-many and many-to-many

·          It enables you to query data using EntitySQL, DBContext, and ObjectContext

·          It provides loosely coupled approach

 11)Explain Lazy loading, Eager Loading, and Explicit Loading?

  • Lazy Loading:It is a process to delay the loading of related objects until it is required.
  • Eager Loading:It occurs when you query for an object and all of the related objects are also returned. In eager loading, related objects are loaded automatically with its parent object
  • Explicit Loading:Explicitly loading takes place when you have disabled Lazy loading, and you still want to lazy loading. For this, we have to call the load method on the related entities.

12)What is MVC (Model view controller)?

Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representation of information from the way that information is presented to or accepted from the user.
MVC is a framework for building web applications using a MVC (Model View Controller) design:

  • The Model represents the application core (for instance a list of database records).
  • The View displays the data (the database records).
  • The Controller handles the input (to the database records).

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

The MVC model defines web applications with 3 logic layers:

  • The business layer (Model logic)
  • The display layer (View logic)
  • The input control (Controller logic)

The Model is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.The View is the part of the application that handles the display of the data. Most often the views are created from the model data.The Controller is the part of the application that handles user interaction.
Typically controllers read data from a view, control user input, and send input data to the model.
The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application.
The MVC separation also simplifies group development. Different developers can work on the view, the controller logic, and the business logic in parallel.

13)What are the advantages of MVC?
Benefits of MVC:

  • Multiple view support
    Due to the separation of the model from the view, the user interface can display multiple views of the same data at the same time.
  • Change Accommodation
    User interfaces tend to change more frequently than business rules (different colors, fonts, screen layouts, and levels of support for new devices such as cell phones or PDAs) because the model does not depend on the views, adding new types of views to the system generally does not affect the model. As a result, the scope of change is confined to the view.

SoC – Separation of Concerns:

Separation of Concerns is one of the core advantages of ASP.NET MVC . The MVC framework provides a clean separation of the UI, Business Logic, Model or Data.

More Control:

The ASP.NET MVC framework provides more control over HTML, JavaScript and CSS than the traditional Web Forms.


ASP.NET MVC framework provides better testability of the Web Application and good support for the test driven development too.


ASP.NET MVC framework doesn’t use View State and thus reduces the bandwidth of the requests to an extent.

Full features of ASP.NET:

One of the key advantages of using ASP.NET MVC is that it is built on top of ASP.NET framework and hence most of the features of the ASP.NET like membership providers, roles, etc can still be used.

14)Explain MVC application life cycle?

Any web application has two main execution steps, first understanding the request and depending on the type of the request sending out appropriate response. MVC application life cycle is not different it has two main phases, first creating the request object and second sending our response to the browser.

Creating the request object:

The request object creation has four major steps. The following is the detailed explanation of the same.

Step 1: Fill route

MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file.

Step 2: Fetch route

Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” object which has the details of which controller and action to invoke.

Step 3: Request context created

The “RouteData” object is used to create the “RequestContext” object.

Step 4: Controller instance created 

This request object is sent to “MvcHandler” instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class.

Creating Response object:

This phase has two steps executing the action and finally sending the response as a result to the view.

 15)What are Filters in MVC?

In MVC, controllers define action methods and these action methods generally have a one-to-one relationship with UI controls such as clicking a button or a link, etc. For example, in one of our previous examples, the UserController class contained methods UserAdd, UserDelete, etc.

But many times we would like to perform some action before or after a particular operation. For achieving this functionality, ASP.NET MVC provides feature to add pre and post action behaviors on controller’s action methods.

Types of Filters:

ASP.NET MVC framework supports the following action filters:

  • Action Filters: Action filters are used to implement logic that gets executed before and after a controller action executes. We will look at Action Filters in detail in this chapter.
  • Authorization Filters: Authorization filters are used to implement authentication and authorization for controller actions.
  • Result Filters: Result filters contain logic that is executed before and after a view result is executed. For example, you might want to modify a view result right before the view is rendered to the browser.
  • Exception Filters: Exception filters are the last type of filter to run. You can use an exception filter to handle errors raised by either your controller actions or controller action results. You can also use exception filters to log errors.

Action filters are one of most commonly used filters to perform additional data processing, or manipulating the return values or cancelling the execution of action or modifying the view structure at run time.

16)Mention what is the difference between Temp data, View, and View Bag?

In ASP.NET MVC there are three ways to pass/store data between the controllers and views.


  1. ViewData is used to pass data from controller to view.
  2. It is derived from ViewDataDictionary class.
  3. It is available for the current request only.
  4. Requires typecasting for complex data type and checks for null values to avoid error.
  5. If redirection occurs, then its value becomes null.


  1. ViewBag is also used to pass data from the controller to the respective view.
  2. ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0
  3. It is also available for the current request only.
  4. If redirection occurs, then its value becomes null.
  5. Doesn’t require typecasting for complex data type.


  1. TempData is derived from TempDataDictionary class
  2. TempData is used to pass data from the current request to the next request
  3. 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
  4. 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

17)What is Bundling and Minification in MVC?

Bundling and minification are two new techniques introduced to improve request load time. It improves load time by reducing the number of requests to the server and reducing the size of requested assets (such as CSS and JavaScript).

Bundling: It lets us combine multiple JavaScript (.js) files or multiple cascading style sheet (.css) files so that they can be downloaded as a unit, rather than making individual HTTP requests.

Minification: It squeezes out whitespace and performs other types of compression to make the downloaded files as small as possible. At runtime, the process identifies the user agent, for example IE, Mozilla, etc. and then removes whatever is specific to Mozilla when the request comes from IE.

  18)List out the types of result in MVC?

In MVC, there are twelve types of results in MVC where “ActionResult” class is the main class while the 11 are their sub-types

  • ViewResult
  • PartialViewResult
  • EmptyResult
  • RedirectResult
  • RedirectToRouteResult
  • JsonResult
  • JavaScriptResult
  • ContentResult
  • FileContentResult
  • FileStreamResult
  • FilePathResult
19 )What is ASP.NET Web API?
ASP.NET Web API is a framework that simplifies building HTTP services for broader range of clients (including browsers as well as mobile devices) on top of .NET Framework.

Using ASP.NET Web API, we can create non-SOAP based services like plain XML or JSON strings, etc. with many other advantages including:

  • Create resource-oriented services using the full features of HTTP
  • Exposing services to a variety of clients easily like browsers or mobile devices, etc.
 20)What are the Advantages of Using ASP.NET Web API?

Using ASP.NET Web API has a number of advantages, but core of the advantages are:

  • It works the HTTP way using standard HTTP verbs likeGET, POST, PUT, DELETE, etc. for all CRUD operations
  • Complete support for routing
  • Response generated in JSON or XML format usingMediaTypeFormatter
  • It has the ability to be hosted in IIS as well as self-host outside of IIS
  • Supports Model binding and Validation.

to our newsletter

Drop Us A Query

Trending Courses
  • oracle 12c rac | OnlineITGuru
    Oracle RAC Training
  • Oracle is the large vendor in providing the various storge services to the people across the globe. This vendor provides a different amount of storage services to the people across the globe.

  • salesforce lightning training | OnlineITGuru
    Salesforce Lightning Training
  • Developing an application is not a simple and easy task. There are various parameters that the web developer need to take care while developing an application. One of those parameters that the developer needs to take care of is the code reusability.

  • Selenium with python
    Selenium with Python Training
  • As we know, that Selenium with Python Web Browser Selenium Automation is Gaining Popularity Day by Day. So many Frameworks and Tools Have arisen to get Services to Developers.

  • machine learning with python
    Machine Learning with Python Training
  • Over last few years, Big Data and analysis have come up, with Exponential and modified Direction of Business. That operate Python, emerged with a fast and strong Contender for going with Predictive Analysis.

  • Data science with R
    Data Science With R Training
  • Understanding and using Linear, non-linear regression Models and Classifying techniques for stats analysis. Hypothesis testing sample methods, to get business decisions.

  • data science with python
    Data Science with Python Training
  • Everyone starts Somewhere, first you learn basics of Every Scripting concept. Here you need complete Introduction to Data Science python libraries Concepts.


100% Secure Payments. All major credit & debit cards accepted.

Call Now Button