1. What are partial classes in ASP.NET ?  

Partial classes can be defined in more than one location and can have different members. So you can save partial classes in different physical locations, but logically when you create the object they will act like one class. Below figure ‘Partial classes in action’ shows ‘ClsMyPartial’ in two different physical files ‘Class1’ and ‘Class2’. In one physical file we have added ‘Method1’ and in the second file we have added ‘Method2’. Both these methods belong to class ‘ClsMyPartial’ but are located in different physical location. Maintaining same class in different physical location increases maintainability in project.

2. Describe state management in ASP.NET.  

State management is a technique to manage a state of an object on different request. The HTTP protocol is the fundamental protocol of the World Wide Web. HTTP is a stateless protocol means every request is from new user with respect to web server. HTTP protocol does not provide you with any method of determining whether any two requests are made by the same person. Maintaining state is important in any web application. There are two types of state management system in ASP.NET. - Client-side state management - Server-side state management

3. Explain client side state management system.  

ASP.NET provides several techniques for storing state information on the client. These include the following: view state- ASP.NET uses view state to track values in controls between page requests. It works within the page only. You cannot use view state value in next page. control state- You can persist information about a control that is not part of the view state. If view state is disabled for a control or the page, the control state will still work. hidden fields- It stores data without displaying that control and data to the user’s browser. This data is presented back to the server and is available when the form is processed. Hidden fields data is available within the page only (page-scoped data). Cookies- Cookies are small piece of information that server creates on the browser. Cookies store a value in the user’s browser that the browser sends with every page request to the web server. Query strings- In query strings, values are stored at the end of the URL. These values are visible to the user through his or her browser’s address bar. Query strings are not secure. You should not send secret information through the query string.

4. Explain server side state management system.  

The following objects are used to store the information on the server:

Application State-

This object stores the data that is accessible to all pages in a given Web application. The Application object contains global variables for your ASP.NET application.

Cache Object- Caching is the process of storing data that is used frequently by the user. Caching increases your application’s performance, scalability, and availability. You can catch the data on the server or client.

Session State- Session object stores user-specific data between individual requests. This object is same as application object but it stores the data about particular user.

5. Describe the disadvantage of cookies.  

Cookie can store only string value.
Cookies are browser dependent.
Cookies are not secure.
Cookies can store small amount of data.


What is Session object? Describe in detail.


HTTP is a stateless protocol; it can't hold the user information on web page. If user inserts some information, and move to the next page, that data will be lost and user would not able to retrieve the information. For accessing that information we have to store information. Session provides that facility to store information on server memory. It can support any type of object to store. For every user Session data store separately means session is user specific.

Session [“message”] = “Hello World!”;

Retreving the data from Session object.

Label1.Text = Session[“message”].ToString();

7. What does the Orientation property do in a Menu control?  

Orientation property of the Menu control sets the display of menu on a Web page to vertical or horizontal. Originally the orientation is set to vertical.

8. What are Web server controls in ASP.NET?  

These are the objects on ASP.NET pages that run when the Web page is requested.

Some of these Web server controls, like button and text box, are similar to the HTML controls.

Some controls exhibit complex behavior like the controls used to connect to data sources and display data.

9. Differentiate between a page theme and a global theme?  

Page theme applies to a particular web pages of the project. It is stored inside a subfolder of the App_Themes folder.

Global theme applies to all the web applications on the web server. It is stored inside the Themes folder on a Web server.

10. How do Cookies work? Give an example of their abuse.  

The server directs the browser to put some files in a cookie. All the cookies are then sent for the domain in each request.

An example of cookie abuse could be a case where a large cookie is stored affecting the network traffic.

11. What are the various types of Cookies in ASP.NET?  

There exist two types of cookies in ASP.NET

Session Cookie - It resides on the machine of the client for a single session and works until the user logs out of the session.

Persistent Cookie - It resides on the machine of a user for a specified period. This period can be set up manually by the user.

12. How would you create a permanent cookie?  

Permanent cookies are stored on the hard disk and are available until a specified expiration date is reached.

To create a cookie that never expires set its Expires property equal to DateTime.maxValue.

13. Explain Culture and UICulture values.  

Culture value determines the functions like Date and Currency used to format data and numbers in a Web page.

UICulture value determines the resources like strings or images loaded in a Web application for a Web page.

14. What is Global.asax file used for?  

It executes application-level events and sets application-level variables.

15. What is event bubbling?  

When child control send events to parent it is termed as event bubbling.

Server controls like Data grid, Data List, and Repeater can have other child controls inside them.

16. What are the different kinds of assemblies?  

There can be two types of assemblies.

Static assemblies -

They are stored on disk in portable executable files.
It includes .NET Framework types like interfaces and classes, resources for the assembly (bitmaps, JPEG files, resource files etc.).

Dynamic assemblies -

They are not saved on disk before execution rather they run directly from memory.
They can be saved to disk after they have been executed.

17. Explain ViewState.  

It is a .Net mechanism to store the posted data among post backs.
It allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.

18. What is caching?  

Caching is the technique of storing frequently used items in memory so that they can be accessed more quickly. By caching the response, the request is served from the response already stored in memory. It’s important to choose the items to cache wisely as Caching incurs overhead. A Web form that is frequently used and does not contain data that frequently changes is good for caching. A cached web form freezes form’s server-side content and changes to that content do not appear until the cache is refreshed.

19. Explain the use of duration attribute of @OutputCache page directive.  

The @OutputCache directive’s Duration attribute determines how long the page is cached. If the duration attribute is set to 60 seconds, the Web form is cached for 60 seconds; the server loads the response in memory and retains that response for 60 seconds. Any requests during that time receive the cached response. Once the cache duration has expired, the next request generates a new response and cached for another 60 seconds.

20. Define Virtual folder.  

It is the folder that contains web applications. The folder that has been published as virtual folder by IIS can only contain web applications.

.Net Interview Question

PHP Interview Question

Java Interview Question

AngularJS Interview Questions