ASP.NET Interview Questions and Answers SET – 3

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

What is the control for which by default postback is enabled?


How do you implement postback in textbox?

By making AutoPostBack property of the textbox as true we can implement postback in textbox

What is the difference between LinkButton and HyperLink in

LinkButton contains 2 extra events as compared to HyperLink i.e. Command and Click. So you can execute server code in LinkButton before navigating to specified URL.

In which database information about membership, role management and web parts personalization is stored?


WebConfigurationManager.OpenWebConfiguration throws error – Failed to map the path ‘/’ error

Try the following steps

  1. Inside OpenWebConfiguration() method pass either ‘~’ or HttpContext.Current.Request.ApplicationPath as path.
  2. Open visual studio in admin mode.
How to bind dropdown with XML string?
string xmlString = "<root><country><id>1</id><name>India</name></country><country><id>2</id><name>Australia</name></country><country><id>3</id><name>Srilanka</name></country></root>";
using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
    DataSet ds = new DataSet();

    if (ds != null)
        if (ds.Tables.Count > 0)
            DropDownList1.DataSource = ds.Tables[0];
            DropDownList1.DataValueField = "ID";
            DropDownList1.DataTextField = "name";
What is the difference between Render Vs CreateChildControls method while creating the custom control?

Render method is used when we have read only controls and we don’t want controls to handle events or post-backs, but CreateChildControls method we can handle events and post-backs.

What is the difference between UICulture and Culture in

UICulture is related to content of the website whereas Culture is related to culture-dependent functions such as the date, number, and currency formatting etc.

How will you ensure that original URL in the browser is not changed if user is sent to error page?

In customErrors tag set the value of redirectMode as ‘ResponseRewrite’

<customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="error_page"></customErrors>
What is a ViewState?

View state is a technique to persist state of the webpage between post backs.

The view state is by default stored in the hidden field __VIEWSTATE.

When the user submits data all the controls data are serialized into base 64 encoding and saves it into hidden field and when the page is again loaded then the data is de-serialized and updates the controls.