ASP.NET Interview Questions and Answers SET – 2



Following are some basic Interview Questions and Answers set of ASP.NET.

How can you display all validation messages in one control?

We can display in one control using ValidationSummary control.

How can you register a custom server control to a Web page?

We can register a custom server control using @Register directive.

What is the default timeout for a Cookie?

30 minutes

How many web.config files can I have in an application?

There can be one web.config file in the root folder. But you can place a web.config file inside the folder.

What is the difference between inline and code behind in asp.net?

Inline code is written in the same aspx file where HTML code is written whereas in code behind all the code is written in separate file and that file is referenced by aspx page.

What base class do all Web Forms inherit from?

System.Web.UI.Page

How is a property designated as read-only?

If we don’t implement set in properties then properties are designated as readonly. For example

public static string SMTPServer
{
	get
	{
		return ConfigurationManager.AppSettings["smtpServer"];
	}
}
Which namespace is needed to implement debug and trace?

System.Diagnostic

What are different types of caching?
  1. Output caching
  2. Fragment caching
  3. Data caching
In which events controls are fully loaded?

Page load events.