ASP.Net Interview Questions and AnswersWhat’s the difference between Response.Write() andResponse.Output.Write()?
Ans: Response.Output.Write() allows you to write formatted output.What methods are fired during the page load?
- Init() - when the page is instantiated
- Load() - when the page is loaded into server memory
- PreRender() - the brief moment before the page is displayed to the user as HTML
- Unload() - when page finishes loading.When during the page processing cycle is ViewState available?
- After the Init() and before the Page_Load(), or OnLoad() for a control.What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.PageWhere do you store the information about the user’s locale?
System.Web.UI.Page.Culture What’s a bubbled event?
When you have a complex control, like DataGrid, 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. What data types do the RangeValidator control support?
Integer, String, and Date.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 performas 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. What base class do all Web Forms inherit from?
The Page class.What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postbacks. What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate. How to manage state in Asp.Net Web applications?
State management is done at client side and server sideClient Side:
Client Side it can achieved with the help of View state, Cookies, Query, String, hidden fields and control state.Server Side:
with the help of Cache, Application,Session and Database. What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed. What is System.Web.Mail?
System.Web.Mail is the .Net namespace used to send email in .Net Framework applications. It contains three classes:
1. MailMessage - used for creating and manipulating the mail message contents.
2. MailAttachments - used for creating a mail attachment to be added to the mail message.
3. SmtpMail - used for sending email to the relay mail server. How many objects does ADO.Net have and what are they?
There are 5 objects in ADO.Net.
They are Connection, Adapter, Command, Reader and Dataset.How does ASP.Net page works?
1. When a browser requests an HTML file, the server returns the file
2. When a browser requests an ASP.Net file, IIS passes the request to the ASP.Net engine on the server.
3. The ASP.Net engine reads the file, line by line, and executes the scripts in the file
4. Finally, the ASP.Net file is returned to the browser as plain HTML.How do you debug an ASP.Net Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger. In order to get assembly info which namespace we should have import?