100 Top ASP.NET Job Interview Questions and Answers

1. Define what is ASP.Net?

ASP.NET was developed in direct response to the problems that developers had with classic ASP. Since ASP is in such wide use, Define, However, Microsoft ensured that ASP scripts execute without modification on a machine with the .NET Framework (the ASP engine, ASP.DLL, is not modified when installing the .NET Framework). Thus, IIS can house both ASP and ASP.NET scripts on the same machine.

Advantages of ASP.NET :

  • Separation of Code from HTML:

To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.

  • Support for compiled languages:

The developer can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

  • Use services provided by the .NET Framework:

The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.

  • Graphical Development Environment:

Visual Studio .NET provides a very rich development environment for web developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code but also for HTML and XML.

  • State management:

To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. The state information can, for example, be kept in memory or stored in a database. It can be shared across web farms, and state information can be recovered, even if the server fails or the connection breaks down.

  • Update files while the server is running:

Components of your application can be updated while the server is online and clients are connected. The framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

  • XML-Based Configuration Files:

Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

  • *ASP.NET Overview:-

Here are some points that give a quick overview of ASP.NET.

  1. ASP.NET provides services to allow the creation, deployment, and execution of. Web Applications and Web Services.
  2. Like ASP, ASP.NET is a server-side technology.
  3. Web Applications are built using Web Forms. ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.
  4. Web Forms are designed to make building web-based applications as easy as building Visual Basic applications.

2. Define what’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().

3. In which event of page cycle is the ViewState available?
After the Init() and before the Page_Load().

4. Define what is the difference between Server. Transfer and Response. Redirect?

In Server. Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. The clients URL history list or current URL Server does not update in case of Server. Transfer.

Response. Redirect is used to redirect the user’s browser to another page or site. It performs a trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.

5. From which base class all Web Forms are inherited?

Page class.

6. What are the different validators in ASP.NET?

  • Required Field Validator
  • Range Validator
  • Compare Validator
  • Custom Validator
  • Regular expression Validator
  • Summary Validator

7. Which validator control you use if you need to make sure the values in two different controls matched?

Compare Validator control.

8. Define what is ViewState?

ViewState is used to retain the state of server-side objects between page postbacks.

9. Where the ViewState is stored after the page postback?

ViewState is stored in a hidden field on the page at the client side. ViewState is transported to the client and back to the server and is not stored on the server or any other external source.

10. How long the items in ViewState exists?

They exist for the life of the current page.

11. Define what are the different Session state management options available in ASP.NET?

  1. In-Process
  2. Out-of-Process.
    In-Process stores the session in memory on the web server.

Out-of-Process Session state management stores data in an external server. The external server may be either a SQL Server or a State Server. All objects stored in session are required to be serializable for Out-of-Process state management.

12. Describe the advantages of writing a managed code application instead of unmanaged one. Define what’s involved in a certain piece of code being managed?

“Advantage includes automatic garbage collection,memory management,security,type checking,versioning
Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security,
memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely and take better advantage of developers existing expertise in languages that support the .NET Framework.
Unmanaged code includes all code written before the .NET Framework was introduced—this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities.”

13. What are Boxing and UnBoxing?

Boxing is an implicit conversion of ValueTypes to Reference Types (Object). UnBoxing is an explicit conversion of Reference Types (Object) to its equivalent ValueTypes. It requires type-casting.

14. What is the sequence of operation takes place when a page is loaded?

BeginTranaction – only if the request is transacted
Init – every time a page is processed
LoadViewState – Only on postback
ProcessPostData1 – Only on postback
Load – every time
ProcessData2 – Only on Postback
RaiseChangedEvent – Only on Postback
RaisePostBackEvent – Only on Postback
PreRender – everytime
BuildTraceTree – only if tracing is enabled
SaveViewState – every time
Render – Everytime
End Transaction – only if the request is transacted
Trace.EndRequest – only when tracing is enabled
UnloadRecursive – Every request

15. What are the different types of assemblies available and their purpose?

Private, Public/shared and Satellite Assemblies.

  • Private Assemblies: Assembly used within an application is known as private assemblies.
  • Public/shared Assemblies: Assembly which can be shared across the application is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).
  • Satellite Assemblies: These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying a Global application for different languages.

16. What are the Navigations technique in ASP.NET?

Navigation can cause data loss if it not properly handled. We do have many techniques to transfer data from one page to another but every technique has its own importance and benefits.

We will discuss the following techniques in this article.

  • Response.Redirect
  • Server.Transfer
  • Server.Execute
  • Cross page posting

17. Describe the role of inetinfo.exe, aspnet_isapi.dll and aspnet_wp.exe in the page loading process?
inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

18. Where do you store the information about the user’s locale?

19. Describe the difference between inline and code behind.
Inline code is written along side the HTML in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

20. Define what is different b/w webconfig.xml & Machineconfig.xml
Web.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration files.Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.
If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application are spanned across three web-servers (using round-robbin load balancing) Define what would be the best approach to maintain login-in state for the users?
Use the state server or store the state in the database. This can be easily done through a simple setting change in the web.config.

You can specify mode as “state server” or “SQL server”.
Where would you use an iHTTPModule, and Define what are the limitations of any approach you might take in implementing one
“One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.

21. How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32) but also the version of the assembly.

22. Define what are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.

23. What is a satellite assembly?
When you write a multilingual or multi-cultural application in .NET and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

24. What namespaces are necessary to create a localized application?
System.Globalization and System.Resources.

25. What is the smallest unit of execution in .NET?
an Assembly.

26. When should you call the garbage collector in .NET?
As a good rule, you should not call the garbage collector. Define, However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. Define, However, this is usually not a good practice.

27. How do you convert a value-type to a reference-type?
Use Boxing.

28. Define what happens in memory when you Box and Unbox a value-type?
Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack

29. Describe the difference between a Thread and a Process?
A Process is an instance of a running application. And a thread is the Execution stream of the Process. A process can have multiple Thread.
When a process starts a specific memory area is allocated to it. When there are multiple threads in a process, each thread gets a memory for storing the variables in it and plus they can access the global variables which are common for all the thread. Eg. A Microsoft Word is an Application. When you open a word file, an instance of the Word starts and a process is allocated to this instance which has one thread.

30. What is the difference between an EXE and a DLL?

  • You can create an object of Dell but not of the EXE.
  • Dell is an In-Process Component whereas EXE is an OUt-Process Component.Exe is for single use whereas you can use Dell for multiple uses.
  • Exe can be started as standalone where all cannot be.

ASP.NET Questions pdf free download::

31. Can we add code files of different languages in the App_Code folder?

No. The code files must be in the same language to be kept in the App_code folder.

32. What is the GAC? Define what problem does it solve?
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine.
All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. Define However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
There are several ways to deploy an assembly into the global assembly cache:

  • Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
  • Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
  • Use Windows Explorer to drag assemblies into the cache.
    GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but a different version. This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.

33. Define what is an Assembly Qualified Name? Is it a filename? Define How is it different?
An assembly qualified name isn’t the filename of the assembly; it’s the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.
e.g. (“”System.Xml.XmlDocument, System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″”)

34. Which protocol is used to call a Web service?
HTTP Protocol

35. Can we have multiple web config files for an asp.net application?

36. Define How information about the user’s locale can be accessed?

The information regarding a user’s locale can be accessed by using the System.Web.UI.Page.Culture property.

37. Define what is the base class of .net?


38. Define what is RedirectPermanent in ASP.Net?

RedirectPermanent Performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns 301 Moved Permanently responses.

39. Define what is MVC?

MVC is a framework used to create web applications. The web application base builds on Model-View-Controller pattern which separates the application logic from UI, and the input and events from the user will be controlled by the Controller.

40. Define the working of passport authentication.

First of all, it checks the passport authentication cookie. If the cookie is not available then the application redirects the user to Passport Sign on the page. Passport service authenticates the user details on sign on page and if valid then stores the authenticated cookie on the client machine and then redirect the user to the requested page

41. Is the lack of deterministic destruction in .NET a problem?

It’s certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommends that you provide a method called Dispose() for this purpose. Define, However, this causes problems for distributed objects – in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects – unfortunately, the runtime offers no help with this.

42. In which event are the controls fully loaded?

Page load event.

43. Define what is delay signing?

Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.

44. Define what’s the difference between Response.Write() and Response.Output.Write()?
Response.Write() and Response.Output.Write() both are used for print output on the screen.
But there are is a difference between both of them
1. Response.Output.Write() is allows us to print formatted output but Response.Write() can’t allow the formatted output.
Response.Output.Write(“.Net{0},”ASP”); // Its write
Response.Write(“.Net{0},”ASP”); // Its Wrong

2. As Per Asp.Net 3.5, Response.Write() Has 4 overloads, with Response.Output.Write()
has 17 overloads .

45. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

46. Define what’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.

47. Define what data types do the RangeValidator control support?
Integer, String, and Date.

48. Explain the differences between Server-side and Client-side code?
The server-side code executes on the server. The client-side code executes in the client’s browser.

49. Define what type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. Define, However, during the code-behind’s execution on the server, it can render client-side code such as JavaScript to be processed in the client’s browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

50. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.

51. Which data type does the RangeValidator control support?

The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date.

52. Define what is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?

In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas, in HtmlInputRadioButton controls, we can select an only single item from the group of items.

53. Which namespaces are necessary to create a localized application?



54. Define what are the different types of cookies in ASP.NET?

Session Cookie – Resides on the client machine for a single session until the user does not log out.

Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days, one month, and never.

55. Define what is the file extension of web service?

Web services have file extension .asmx.

56. Define what are the components of ADO.NET?

The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.

57. Define what is the difference between ExecuteScalar and ExecuteNonQuery?

ExecuteScalar returns output value where as ExecuteNonQuery does not return any value but the number of rows affected by the query. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to execute Insert and Update statements.

58. Define what is Remoting?

Remoting is a means by which one operating system process, or program, can communicate with another process. The two processes can exist on the same computer or on two computers connected by a LAN or the Internet.

59. Define what’s the use of “GLOBAL.ASAX” file?

It allows to executing ASP.NET application level events and setting application-level variables.

60. Define what is a SESSION and APPLICATION object?

Session object store information between HTTP requests for a particular user.
Session variables are used to store user-specific information whereas in application variables we can’t store user-specific information.
while the application object is global across users.