Reference Page: C-Language|C++|C#|VB.Net|Asp.Net

Asp.Net Links : Learn     Interview Questions     Software IDE Asp.Net Jobs : Indeed.com     ZipRecruiter.com     Monster.com

Asp.Net & WebApi Interview Questions - Page 2

< Previous Page              Next Page >
Question: What is a Global.asax file?
Answer: Global.asax file is an optional component in any ASP.NET-based application that handles important application events such as Application_Start, Application_End, Session_Start, Session_End, and more.

Question: What are the major events handled by Global.asax file?
Answer: The Global.asax controls following major events:
Application_Start: Invoked when the application first starts up and the application domain is created. This event handler is a useful place to provide application-wide initialization code.
Application_End: Invoked just before an application ends. The end of an application can occur because IIS restart or because of application is transitioning to a new app domain due to updated files or process recycling.
Session_Start: Invoked each time a new session begins. This is often used to initialize user-specific information. • Session_End: Invoked whenever an user's session ends. Session ends when code explicitly releases it or when it timesout when no more requests received within a given timeout period (typically 20 minutes).

Question: What is web.config file and what is the use of it?
Answer: The web.config file contains configuration settings for Asp.Net application which is kept separated from the code. One can configure HTTP modules and handlers in web.config file to intercept and process incoming requests. Also one can use it for URL rewriting, authentication, custom request processing. It also allows one to encrypt the configuration settings for increased security.

Question: What is the major difference between Web.config and Machine.config file?
Answer: The Web.config is used to define application-level settings. If any setting is not specified in Web.config it is inherited from Machine.config by default.

Machine.config remains at the highest level in the configuration hierarchy and is used for defining server level settings and is automatically installed while installing Visual Studio.NET.

Question: Can you specify different page level events in Asp.Net?
Answer: Here are different page level events for Asp.Net:
• PreInit: This is the first event of a page where values like master page is set.
• Init: This fires after each control have been initialized.
• InitComplete: This is raised after all initializations of a page and controls have been completed.
• PreLoad: This fires before the view state has been loaded for a page and its controls and before page postback processing.
• Load (PageLoad): The is used to check postback and to set control properties appropriately.
• ControlEvents (Postback): This event is called when a page or its controls causes postback say a Button Click, etc.
• LoadComplete: At this event, all controls are loaded.
• PreRender: This takes place before the view state is saved.
• SaveStateComplete: This event is useful if one needs to write processing that requires the view state to be set.
• Render: This is actually a method of a page object where controls are rendered for the browser.
• Unload: This is used to clean up code and to manually release resources.

Question: Is there any difference between Hyperlink and LinkButton?
Answer: Though both does similar type of work but Hyperlink control does not have any Click or Command events - whereas the LinkButton control has them.



< Previous Page Next Page >