Breaking News
Loading...
Thursday 30 May 2013

ASP .NET Interview Questions and Answers 8

04:52
106. What are server-side comments?

Server-side comments are included in an ASP.NET page for the purpose of documentations as shown in the following code snippet:

<%--This is an example of server-side comments --%>

The server-side comments begin with <%-- and end with --%>.

107. How can we provide the WebParts control functionality to a server control?

We can provide the WebParts controls functionality to a server control by setting the CreateWebPart property of WebPartManger.

108. How do you prevent a validation control from validating data at the client end?

You can prohibit a validation control to validate data at the client side by setting the EnableClientScript property to False.

109. What is cross-page posting in ASP.NET?

The Server.Transfer() method is used to post data from one page to another. In this case, the URL remains the same. However, in cross page posting, data is collected from different Web pages and is displayed on a single page. To do so, you need to set the PostBackUrl property of the control, which specifies the target page. In the target page, you can access the PreviousPage property. For this, you need to use the @PreviousPageType directive. You can access the controls of previous page by using the FindControl() method.

110. Which ASP.NET configuration options are supported in the ASP.NET implementation on the shared Web hosting platform?

There are many ASP.NET configuration choices, which are not able to configure at the site, application, or child directory level on the shared hosting environment. Some options can produce security, performance, and stability problem to the server and therefore cannot be changed.

The following settings are the only ones that can be changed in the web.config file(s) of your Web site:
  •     browserCaps
  •     clientTarget
  •     pages
  •     customErrors
  •     globalization
  •     authorization
  •     authentication
  •     webControls
  •     webServices
111. Explain the Application and Session objects in ASP.NET.

Application state is used to store data corresponding to all the variables of an ASP.NET Web application. The data in an application state is stored once and read several times.

Application state uses the HttpApplicationState class to store and share the data throughout the application. You can access the information stored in an application state by using the HttpApplication class property. Data stored in the application state is accessible to all the pages of the application and is the same for all the users accessing the application. The HttpApplicationState class provides a lock method, which you can use to ensure that only one user is able to access and modify the data of an application at any instant of time. Each client accessing a Web application maintains a distinct session with the Web server, and there is also some specific information associated with each of these sessions. Session state is defined in the <sessionState> element of the web.config file. It also stores the data specific to a user session in session variables. Different session variables are created for each user session. In addition, session variables can be accessed from any page of the application. When a user accesses a page, a session ID for the user is created. The session ID is transferred between the server and the client over the HTTP protocol using cookies.

112. How will you differentiate a submaster page from a top-level master page?

Similar to a content page, a submaster page also does not have complete HTML source code; whereas, a top-level master page has complete HTML source code inside its source file.

113. What are Web server controls in ASP.NET?

The ASP.NET Web server controls are objects on the ASP.NET pages that run when the Web page is requested. Many Web server controls, such as button and text box, are similar to the HTML controls. In addition to the HTML controls, there are many controls, which include complex behavior, such as the controls used to connect to data sources and display data.

114. What is the difference between a HyperLink control and a LinkButton control?

A HyperLink control does not have the Click and Command events; whereas, the LinkButton control has these events, which can be handled in the code-behind file of the Web page.

115. What are the various ways of authentication techniques in ASP.NET?

There are various techniques in ASP.NET to authenticate a user. You can use one of the following ways of authentication to select a built-in authentication provider:

    Windows Authentication - This mode works as the default authentication technique. It can work with any form of Microsoft Internet Information Services (IIS) authentication, such as Basic, Integrated Windows authentication (NTLM/Kerberos), Digest, and certificates. The syntax of Windows authentication mode is given as follows: <authentication mode="windows" />

    Forms Authentication - You can specify this mode as a default authentication mode by using

the following code snippet: <authentication mode="Forms"/>
    Passport - This mode works with Microsoft Passport authentication, as shown in the

following code snippet: <authentication mode = "Passport"/>

116. What are the different ways to send data across pages in ASP.NET?

The following two ways are used to send data across pages in ASP.NET:
  •     Session
  •     Public properties
117. What does the WebpartListUserControlPath property of a DeclarativeCatalogPart control  do?

The WebpartListUserControlPath property sets the route of the user defined control to a DeclarativeCatalogPart control.

118. What do you mean by the Web Part controls in ASP.NET?

The Web Part controls are the integrated controls, which are used to create a Web site. These controls allow the users to change the content, outlook, and state of Web pages in a Web browser.

119. What type of the CatalogPart control enables users to restore the Web Parts that have been removed earlier by the user?

The PageCatalogPart control.

120. What is the use of web.config? What is the difference between machine.config and web.config?

ASP.NET configuration files are XML-based text files for application-level settings and are saved with the name web.config. These files are present in multiple directories on an ASP.NET Web application server. The web.config file sets the configuration settings to the directory it is placed in and to all the virtual sub folders under it. The settings in sub directories can optionally override or change the settings specified in the base directory.

The difference between the web.config and machine.config files is given as follows:

    <WinDir>\Microsoft.NET\Framework\<version>\config\machine.config provides default
configuration settings for the entire machine. ASP.NET configures IIS to prohibit the browser directly from accessing the web.config files to make sure that their values cannot be public. Attempts to access those files cause ASP.NET to return the 403: Access Forbidden error. ASP.NET uses these web.config configuration files at runtime to compute hierarchically a sole collection of settings for every URL target request. These settings compute only once and cached across further requests. ASP.NET automatically checks for changing file settings and do not validate the cache if any of the configuration changes made.

121. Explain the concept of states in ASP.NET.

State is quite an innovative concept in Web development because it eliminates the drawback of losing state data due to reloading of a Web page. By using states in a Web application, you can preserve the state of the application either at the server or client end. The state of a Web application helps you to store the runtime changes that have been made to the Web application. For example, as already described earlier, a change in the data source of the Web application might be initiated by a user when he/she selects and saves some products in the shopping cart.

If you are not using states, these changes are discarded and are not saved. You may think that the whole concept of storing states is optional. However, under certain circumstances, using states with applications is imperative. For example, it is necessary to store states for Web applications, such as an e-commerce shopping site or an Intranet site of a company, to keep track of the requests of the users for the items they have selected on the shopping site or the days requested for vacation on the Intranet site.

122. Can we validate a DropDownList by RequiredFieldValidator?

Yes, we can validate a DropDownList by RequiredFieldValidator. To perform this validation, we have to set the Initial Value property of RequiredFieldValidator control.

123. List the features of the Chart control.

The following are the features of the Chart control:
  • Bounds a chart with any data source.
  • Simple manipulation of chart data, such as copying, merging, grouping, sorting, searching,and filtering.
  • Support many statistical and financial formulas for data analysis.
  • Provide advanced chart outlook, such as 2-D, 3-D, lighting, and perspective.
  • Support events and customization.
  • Includes interactivity with Microsoft AJAX.
  • Supports AJAX Content Delivery Network (CDN).


Share This :
Tags:

0 comments:

Post a Comment

 
Toggle Footer