What is EnableViewStateMAC?

When EnableViewStateMAC is true for a page, the encoded and encrypted viewstate is checked to verify that it has not been tempered with on the client machine.

A EnableViewStateMAC is encoded version of the hidden variable that a page’s viewstate is persisted to when sent to the browser.

 

What is HttpHandler?

HttpHanlder is the low level Request and Response API to service incoming Http requests. All handlers implement the IHttpHandler interface. There is no need to use any extra namespace to use it as it contains in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions.

Each incoming HTTP request received by ASP.NET is ultimately processed by a specific instance of a class that implements IHTTPHanlder. IHttpHanlderFactory provides the infrastructure that handles the actual resolution of URL requests to IHttpHanlder instances. In addition to the default IHttpHandlerFactory classes provided by ASP.NET, developers can optionally create and register factories to support rich request resolution.

How do you retrieve username in case of Windows Authentication?

System.Environment.UserName

Types of Configuration files and their difference?

  1. Application level config = Web.config.
  2. Machine level config = Machine.config.

What is custom tag in web.config file?

Custom tag allows you to create your own tag and specify key value pair for it.

Difference between DataSet and DataReader.

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

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.