Select Category 
 

Asp.Net Interview Questions Answers

Asp.Net Interview Question - 1 : -

What is the Global.asax used for?

Asp.Net Interview Answer - 1 : -

The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
 

Asp.Net Interview Question - 2 : -

Difference between asp and asp.net?.

Asp.Net Interview Answer - 2 : -

  "ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web applications, ASP.NET is Managed compiled code - asp is interpreted. and ASP.net is fully Object oriented. ASP.NET has been entirely re-architected to provide a highly productive programming experience based on the .NET Framework, and a robust infrastructure for building reliable and scalable web
applications."
 

Asp.Net Interview Question - 3 : -

What are the advantages and  disadvantages of viewstate?

Asp.Net Interview Answer - 3 : -

 

The primary advantages of the ViewState feature in ASP.NET are:

1. Simplicity. There is no need to write possibly complex code to store form data between page submissions.
2. Flexibility. It is possible to enable
, configure, and disable ViewState on a control-by-control basis, choosing to persist the values of some fields but not others.

There are, however a few disadvantages that are worth pointing out:

1. Does not track across pages. ViewState information does not automatically transfer from page to page. With the session
approach
, values can be stored in the session and accessed from other pages. This is not possible with ViewState, so storing
data into the session must be done explicitly.

2. ViewState is not suitable for transferring data for back-end systems. That is, data still has to be transferred to the back
end using some form of data object.

 

Asp.Net Interview Question - 4 : -

 What is validationsummary server control?where it is used?.

Asp.Net Interview Answer - 4 : -

  The ValidationSummary control allows you to summarize the error messages from all validation controls on a Web page in a single location. The summary can be displayed as a list, a bulleted list, or a single paragraph, based on the value of the DisplayMode property. The error message displayed in the ValidationSummary control for each validation control on the page is specified by the ErrorMessage property of each validation control. If the ErrorMessage property of the validation control is not set, no error message is displayed in the ValidationSummary control for that validation control. You can also specify a custom title in the heading section of the ValidationSummary control by setting the HeaderText property. You can control whether the ValidationSummary control is displayed or hidden by setting the ShowSummary property. The summary can also be displayed in a message box by setting the ShowMessageBox property to true.
 

Asp.Net Interview Question - 5 : -

Which control would you use if you needed to make sure the values in two different controls matched?

Asp.Net Interview Answer - 5 : -

CompareValidator control.
 

Asp.Net Interview Question - 6 : -

Can you explain what inheritance is and an example of when you might use it?

Asp.Net Interview Answer - 6 : -

When you want to inherit (use the functionality of) another class.  Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
 

Asp.Net Interview Question - 7 : -

What's the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript?

Asp.Net Interview Answer - 7 : -

 

RegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not   packaged in functions-in other words, code that's to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control="MyControl.ascx" %>

 

Asp.Net Interview Question - 8 : -

. What's a bubbled event?

Asp.Net Interview Answer - 8 : -

 

When you have a complex control, likeDataGrid, writing an event processing routine for each object (cell, button,row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents. Suppose you want a certain ASP.NET function executed on MouseOver over a certain button.

 

Asp.Net Interview Question - 9 : -

 What is advantage of viewstate and what are benefits?

Asp.Net Interview Answer - 9 : -

  When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a  form with a lot of information and the server comes back with an error. You will have to go back to  the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your  ViewState.With ASP .NET, the form reappears in the browser window together with all form  values.This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the  page when submitted to the server.
 

Asp.Net Interview Question - 10 : -

 Which method do you use to redirect the user to another page without performing a round trip to the client?

Asp.Net Interview Answer - 10 : -

 

Server.Transfer and Server.Execute

 

Asp.Net Interview Question - 11 : -

Can a user browsing my Web site read my Web.config or Global.asax files?

Asp.Net Interview Answer - 11 : -

<HTTPHANDLERS>section of Machine.config, which holds the master configuration  settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected  other file types to an HTTP handler named HttpForbiddenHandlerWhat's the difference between Response.Write() andResponse.Output.Write()?

Asp.Net Interview Answer - 12 : -

latter one allows you to write formattedoutput.


 

Asp.Net Interview Question - 13 : -

What is the difference between in-proc and out-of-proc?

Asp.Net Interview Answer - 13 : -

  An inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it.Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed.
 

Asp.Net Interview Question - 14 : -

. How does dynamic discovery work?

Asp.Net Interview Answer - 14 : -

? ASP.NET maps the file name extension VSDISCO to an HTTP handler that scans the host  directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document. A client who requests a VSDISCO file gets back what appears to be a static DISCO document.
Note that VSDISCO files are disabled in the release version of ASP.NET. You can reenable them by uncommenting the line   in the <httpHandlers> section of Machine.config that maps *.vsdisco to System.Web.Services.Discovery.DiscoveryRequestHandler and granting the ASPNET  user account permission to read the IIS metabase. However
, Microsoft is actively discouraging the use of VSDISCO files because they could represent a threat to Web server security.
 

 

Asp.Net Interview Question - 15 : -

What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?

Asp.Net Interview Answer - 15 : -

You must set the DataSource property and call the DataBind method.