Friday, June 26, 2009

Some Good Question with Answer in Asp.Net


What is a bubbled event in ASP.NET server side controls?
Bubbling an Event
The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy. Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the original control as well as to the control that exposes the bubbled event.


What is smart navigation in ASP.NET Pages?
When a page is requested by an Internet Explorer 5 browser, or later, smart navigation enhances the user's experience of the page by performing the following:

    * Eliminating the flash caused by navigation.
    * Persisting the scroll position when moving from page to page.


Explain the concept of Web Application.
An introduction to web applications
A web application consists of a set of web pages that are generated in response to user requests. The Internet has many different types of web applications, such as search engines, online stores, auctions, news sites, discussion groups, games, and so on.
Properties of web applications

    * Web applications are a type of client/server application. In that type of application, a user at a client computer accesses an application at a server computer. In a web application, the client and server computers are connected via the Internet or via an intranet (a local area network).
    * In a web application, the user works with a web browser at the client computer. The web browser provides the user interface for the application. The most popular web browsers are Microsofts Internet Explorer, .Mozilla Firefox


    * The application runs on the server computer under the control of web server software. For ASP.NET web applications, the server must run Microsofts web server, called Internet Information Services, or IIS.
    * For most web applications, the server computer also runs a database management system, or DBMS, such as Microsofts SQL Server. The DBMS provides access to information stored in a database. To improve performance on larger applications, the DBMS can be run on a separate server computer.
    * The user interface for a web application is implemented as a series of web pages that are displayed in the web browser. Each web page is defined by a web form using HTML, or Hypertext Markup Language, which is a standardized set of markup tags.
    * The web browser and web server exchange information using HTTP (Hypertext Transfer Protocol).

Why should you avoid the excessive use of ViewState in Asp.Net web page?
Automatic state management is a feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field.

Since the view state data resides in a hidden form field (__VIEWSTATE); ViewState increases the size of page and results in slow loading of page at browser. You should be aware of when ViewState is helping you and when it is not.

For example, if you are binding a control to data on every round trip , then you do not need the control to maintain it's view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false, as in the following example:

< asp:datagrid EnableViewState="false" datasource="..." runat="server"/>

Explain Web.config Settings for exception management in ASP.NET.
You should configure exception management settings within your application's Web.config file. The following is an example of the exception settings in a Web.config file.

< customErrors defaultredirect="http://hostname/error.aspx" mode="On"/> 
  < error statuscode="500" redirect="/errorpages/servererror.aspx" />
  < error statuscode="404" redirect="/errorpages/filenotfound.htm" />
< /customErrors>
 
In the customErrors element, specify a default redirect page. There are three modes for the default redirect page:

On
Unhandled exceptions will redirect the user to the specified defaultredirect page. This is used mainly in production.

Off
Users will see the exception information and not be redirected to the defaultredirect page. This is used mainly in development.

RemoteOnly
Only users accessing the site on the local machine (using localhost) will see the exception information while all other users will be redirected to the defaultredirect page. This is used mainly for debugging.

No comments:

Post a Comment