What is the difference between ViewState and SessionState?

ViewState persist the values of controls of particular page in the client when post back operation done. When user requests another page previous page data no longer available.

SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.

What is the difference between the Theme and StylesheetTheme?

The StylesheetTheme attribute works same as the Theme attribute.The difference is that the when attributes are set locally on the page within a particular control, the attributes are overridden by the theme if you use the Theme attribute. They are kept in place, if you apply the page’s theme using the StylesheetTheme attribute. Suppose you have a text box control like the following:

<asp:Textbox ID=”TextBox1” Runat=”server”

ForeColor=”#ffffff” />

In this example, the ForeColor settings is overridden by the theme if you have
applied it using the Theme attribute in the Page directive. If, instead, you applied the theme using the StylesheetTheme attribute in the Page directive, the ForeColor settings remain in place, even if they are explicitly defined in the theme.

What’s the difference between System.String and System.StringBuilder classes?

System.String is immutable.
System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. Append Keyword is used in System.StringBuilder but not in System.String.

What is the difference between Response.Write() and Response.Output.Write()?

Both the commands are used to display the output on the screen.

Response.Write() is used to display a single line output.

Response.Output.Write() is used to display a formatable output.




What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next 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. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user’s browser to another page or site. This performance 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.

Difference between DataSet and DataReader.


DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can’t do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can’t fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data.


DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.

DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database.