Naukri
Naukri
1. What is ASP.NET?
2. What is the ASP.NET MVC framework?
3. Which would be the correct framework to be used ASP.NET MVC or ASP.NET Web API?
4. What is Server control?
5. What is Razor in ASP.NET?
6. What is the REST architecture?
7. What are the different types of Authentication in ASP.NET?
8. What is Caching and its different types?
9. What is Query String in ASP? And what are its advantages and disadvantages?
10. What does the method ‘Finalize’ do in ASP.NET?
11. What are the steps in the ASP.NET page life cycle?
12. What is the web.config file?
13. Which compiler is used in ASP.NET?
14. ASP.NET is open-source. Explain?
15. Explain the Global.asax file?
16. What all types of Server controls are supported by ASP.NET?
17. What does “PostBack” mean in ASP.NET?
18. Explain the difference between Web.config and Machine.config file?
19. Write a step for Request Flow in ASP.NET MVC framework?
20. Explain the various modes for the Session state in ASP.NET?
21. Write down different return types of a controller action method?
22. How to maintain sessions in MVC?
23. What is NuGet package manager?
24. What is the use of the Program class?
25. What is the use of the Startup class?
26. What is the use of the wwwroot folder?
27. What is the use of the appsettings.json file?
28. What is IIS?
29. What is dependency injection?
30.How does dependency injection works in ASP.NET Core?
31. What is a cookie?
32. What is the difference between Hyperlink and LinkButton?
33. What are navigation controls?
34. What are Globalization and Localization?
35. What is a Resource File?
36. What are Local Resources and Global Resources?
37. What is Neutral Culture, Culture, and Language?
38. What are the built-in objects in ASP.NET?
39. What do you mean by Role-based security?
40. What is event bubbling?
41. What is the command used to verify the presence of ASP.NET in the system?
42. What are the core sections of the ASP.NET App page?
43. What are page directives in ASP.NET App?
44. What is the response object in ASP.NET App?
ASP.NET Interview Questions
1. What is ASP.NET?
The ASP.NET is a component of the .NET Framework that may be used to build
dynamic websites, online applications, and web services. It's a server-side
technology that works with any .NET compatible languages, such as C#, VB.NET,
and J#, and compiles them to Microsoft Intermediate Language (MSIL). ASP.NET
makes it simple to create a fast and interactive application using server controls.
ASP.NET has the following features:
It builds websites using the C# and VB.NET programming languages.
It allows us to keep the HTML layout and server-side code separate.
It enables us to qualify the same class name in a separate namespace.
The pages in ASP.NET are compiled rather than interpreted.
ASP.NET is a request processing engine. It receives an incoming request
and routes it through its internal pipeline to an endpoint to which a
developer may attach code to process it.
2. What is the ASP.NET MVC framework?
ASP.NET MVC is a lightweight web application framework with a lot of tested
features. Model, View, and Controller are the three types of components supported
by ASP.NET.
The Model component relates to all or any of the data-related logic with
which the user interacts. This will represent the data being transmitted
between the View and Controller components, as well as any other
business logic-related data. A Customer object, for example, will retrieve
customer information from a database, change it, and either update or
output the data back to the database.
The View component is used for all of the appliance's user interface logic.
For example, the Customer view will have all of the UI components that
the final user interacts with, such as text boxes, dropdowns, and so on.
Controllers serve as a link between the Model and Consider components,
processing all business logic and incoming requests, manipulating data
with the Model component, and interacting with Views to render the final
output. The Customer controller, for example, will handle all interactions
and inputs from the Customer View and use the Customer Model to
update the database. The Customer data will be viewed by an analogous
controller.
3. Which would be the correct framework to be used ASP.NET
MVC or ASP.NET Web API?
ASP.Net MVC is used to create online applications that return both the view and the
data, whereas Asp.Net Web API is used to create all HTTP services in a simple and
basic approach that only returns data, not the view.
Web API allows you to create RESTful services using the.NET Framework, and it
also includes features like content negotiation and self-facilitating that aren't
available in MVC.
Web API also deals with returning information that is particularly intended, such as
JSON, XML, or another, based on the Accept header in the request, and you don't
have to worry about it. Using Json Result, MVC simply returns information in JSON
format.
4. What is Server control?
Server Controls are capabilities in ASP.NET that allow you to manipulate the values
of controls on the server side. This is extremely useful when creating verifying and
dynamically generated web forms.
5. What is Razor in ASP.NET?
Razor in ASP.NET provides the syntax for creating dynamic web pages using C#
and HTML. For SPAs, ASP.NET may be combined with JS (JavaScript) and contains
frameworks such as React and Angular (Single Page Application.)
6. What is the REST architecture?
REST is the acronym for REpresentational State Transfer. REST is an architectural
approach that follows six restrictions specified by Roy Fielding in 2000, rather than a
rigorous standard. Uniform Interface, Client-Server, Stateless, Cacheable, Layered
System, and Code on Demand are the limitations. REST is not limited to XML, and it
is up to the implementer to decide which Media-Type to use, such as XML, JSON, or
plain-text. Furthermore, REST can make use of the SOAP protocol, but SOAP
cannot make use of REST. REST is simple to set up and uses less bandwidth,
making it ideal for mobile devices.
RESTful API Architectural Constraints: The following are six architectural restrictions
that any web service must meet:
Stateless
Cacheable
Client-Server
Layered System
Code on Demand with a Uniform Interface
7. What are the different types of Authentication in ASP.NET?
Authentication is the process of determining a user's identity based on their
credentials. Users' credentials are often in the form of a user ID and password, and
we check them against a database or equivalent alternative to see if they exist. If
they do, the user is a valid candidate for the next step - authorisation. In ASP.NET,
there are several types of authentication to choose from, including:
Form Authentication
Passport Authentication
Windows Authentication
Custom Authentication
8. What is Caching and its different types?
The caching function in Asp.Net allows you to save or cache Web Page output. This
technique is used to save time by not having to recreate the same data. In ASP.NET,
there are three different methods of caching:
Caching of page output
Caching of page fragments
Caching of data
If the user requests the same data or information repeatedly, caching improves
performance.
Caching of page output: It's done by adding an OutputCache directive to
the top of the.aspx page during the design phase.
The Cache object implements data caching, which is useful for rapid
retrieval of application data.
Page Fragment Caching: This technique caches a user control to store a
portion of a Web form response in memory.
9. What is Query String in ASP? And what are its advantages
and disadvantages?
A QueryString is a string of characters entered into a web browser on a computer. It
comes in handy when we need to move a value from one page to another. We can't
use Request if we're sending a significant amount of data. Since it only supports 255
characters, it's called QueryString. To separate numerous query strings, we utilise
the '&' special character. The called ASPX page will have access to any query string
that was available to the calling ASPX page.
10. What does the method ‘Finalize’ do in ASP.NET?
Before the current object is destroyed, the Finalize technique is used to run a
cleanup procedure on unmanaged resources owned by the current object. The
strategy is guaranteed, and it is then available only through this class or a derived
class.
11. What are the steps in the ASP.NET page life cycle?
Starting of page life cycle
Page request
Page Load
Page initialization
Postback event handling
Validation
Unload
Page rendering
12. What is the web.config file?
The configuration file (web.config) is used to manage the various settings that
distinguish a website. The settings are stored in XML files which are different from
the code of your programme. This allows you to freely configure settings from your
code. This file is located in the root directory of the application.
13. Which compiler is used in ASP.NET?
To put together an ASP.NET programme, the Roslyn compiler was used by the NET
framework.
14. ASP.NET is open-source. Explain?
On the .NET (dotNET) platform, ASP.NET is an open-source web framework for
developing web applications. Microsoft released version 1.0 in 2002, allowing users
to create dynamic online applications, services, and websites. The framework is built
to interact with the HTTP convention, which is the most widely used protocol for web-
based applications. ASP.NET is the next version to the ASP (Active Server Pages)
technology, and it represents a substantial advancement in terms of adaptability and
capability. It's an add-on to the .NET framework that includes additional tools and
libraries for developing web-based apps and websites. ASP.NET Core is the cross-
plate form version of ASP.NET, which was released in 2016. The ASP.NET
framework is still being upgraded.
15. Explain the Global.asax file?
Global.asax is a file present in the application root directory that is optional. Session
Start, Session End, Application Start, Application End and other application events
are handled in this file. The ASP.NET application file is another name for it.
Global.asax contains a class which represents your entire application. This file is
compiled at runtime into a dynamically generated .NET class based on the HTTP
Application base class. This file can be sent as an assembly to an ASP.NET
application's bin catalogue. The Global.asax record is built in such a way that if a
user requests the document, it will be rejected. External users are unable to
download or view the code contained within it.
16. What all types of Server controls are supported by
ASP.NET?
In ASP.NET, there are four primary types of server-side controls:
Web Server controls
HTML server controls
Validation controls
User controls
17. What does “PostBack” mean in ASP.NET?
The process of presenting an ASP.NET page to the server for processing is known
as a PostBack. If the page's credentials need to be validated against other sources
(for example, utilising a database to confirm the username and password), PostBack
is used. This is something that a client machine will not be able to do, hence these
details must be 'uploaded back' on the server. As a result, we say that a postback
event occurs on the client side but is handled by code in a server-side of the
webpage.
18. Explain the difference between Web.config and
Machine.config file?
The following are some important differences between Web.config and
Machine.config:
Web.config Machine.config
Web.config, on the other hand, is The machine.config record is your framework's master
a file that stores configuration configuration document, containing several default options.
information in XML format and
is used to apply local settings to
a website.
the values in the Web.config file The parameters in the Machine.config file apply to all asp.net apps
only apply to that particular web on your server
application.
Each web application has its own each.NET Framework form has only one machine.config file.
web.config file, Web.config files
can also be found in directories
within a web application.
Web.config documents contain Machine.config files contain shared values shared by multiple
application-specific information, programmes on the server.
such as database connection
strings.
If you make changes to the If you make changes to the machine.config, you must restart the
web.config, the web application application.
will load them immediately.
Web.config is created When you install Visual Studio.Net, the machine.config document
automatically when you create is created automatically and is located in the
an ASP.Net web application c:windowsmicrosoft.netframeworkversionconfig folder.
project.
Web.config is a configuration Machine.config is the design configuration file for all IIS apps.
file for a specific application.
The initial request is received in this step. After that, route objects are added to the
Route table object in the Global.asax file.
Routing: The second phase involves routing. The URL Routing Module is
used to handle the request after the application receives it from the client.
The Route Table is a table that directs URLs to handlers. A routing
system coordinates with a system that compares the request's URL to the
URL patterns stored in the Route Table. When a match is detected in the
pattern, the Routing engine sends the request to the corresponding
IRouteHandler. It returns a 404 HTTP status if the related URL is not
found in the routing database.
MVC Handler: A RouteHandler that determines the HTTP handler that
will serve the request based on the RequestContext supplied.
Controller: The controller decides which action method will be used in this
stage.
ActionInvoker will identify which Action method needs to be executed
after the controller is instantiated. To pick an action method, utilise the
ActionNameSelectorAttribute and ActionMethodSelectorAttribute
methods. The action method takes user input, executes the result, and
returns a result type that may be viewed.
20. Explain the various modes for the Session state in
ASP.NET?
Sessions are saved on a web server within the application's process. It
might be aspnet wp.exe or w3wp.exe, depending on the IIS version used.
StateServer: The State Server windows administration service is used to
save sessions.
SQLServer: The information from sessions is stored in the SQL Server
database.
A custom session state provider is in charge of all session states.
21. Write down different return types of a controller action
method?
View Result
Javascript Result
Redirect Result
JSON Result
Content Result
22. How to maintain sessions in MVC?
In MVC, we can keep sessions in three different ways:
Temporary data: TempData in ASP.NET MVC is basically a dictionary
object derived from TempDataDictionary.
Viewdata: ViewData maintains data when you move from controller to
view. It is also a dictionary object and derived from ViewDataDictionary.
View bag: The ViewBag is a dynamic type property of ControllerBase
class which is the base class of all the controllers.
23. What is NuGet package manager?
Software developers don't write all of their programming from the ground up. They
rely on code libraries created by other programmers. Any modern development
platform must include a means for developers to obtain and use pre-built libraries,
commonly referred to as packages. The JavaScript ecosystem, for example,
includes NPM (Node Package Manager), which allows developers to identify and
use libraries created by other JavaScript developers.
NuGet is a package manager for .NET framework. It was created by Microsoft to
give users access to thousands of packages created by .NET developers. It also
allows you to share the code you've written with others.
A typical ASP.NET web application relies on a large number of open source NuGet
packages to run. Consider the case of Newtonsoft. Json is a widely used library for
working with JSON data.
24. What is the use of the Program class?
Our application's entry point is the Program.cs class. An ASP.NET programme
begins with a static void Main() function, just like a console application.
This class sets up the web server that will handle the requests. The host is in charge
of the application's initialization and lifespan management, as well as graceful
shutdown.
The host must set up a server and a request processing pipeline at the very least.
Logging, configuration, and dependency injection can all be set up by the host.
25. What is the use of the Startup class?
This class is responsible for two key components of your application: service
registration and the middleware pipeline.
Services are C# classes that provide additional functionality to your application and
are utilised by both the framework and your application. Logging, database, and
other similar applications are examples. These services must be registered in order
to be invoked while your app is running and when it is required.
The middleware pipeline is the order in which an HTTP request is processed by your
application
ConfigureServices() and Configure() are two methods in the Startup class(). The first
approach, as its name implies, registers all of the services that the application
requires. The middleware pipeline is configured using the second technique.
26. What is the use of the wwwroot folder?
Our web application's static files and built assets, such as JavaScript, CSS, and
pictures, are stored under the wwwroot folder. The only folder in the entire project
that is visible to the browser as it is wwwroot.