|1 Crore+ students have signed up on EduRev. Have you?|
43. How can you implement the postback property of an ASP.NET control?
You need to set the AutoPostBack property to True to implement the PostBack property of controls.
44. Explain how Cookies work. Give an example of Cookie abuse.
The server tells the browser to put some files in a cookie, and the client then sends all the cookies for the domain in each request. An example of cookie abuse is large cookies affecting the network traffic.
45. Explain login controls.
Login controls are built-in controls in ASP.Net for providing a login solution to ASP.NET application. The login controls use the membership system to authenticate a user credentials for a Web site.
There are many controls in login controls.
46. What is the use of PlaceHolder control? Can we see it at runtime?
The PlaceHolder control acts as a container for those controls that are dynamically generated at runtime. We cannot see it at runtime because it does not produce any visible output. It used only as a container.
47. What setting must be added in the configuration file to deny a particular user from accessing the secured resources?
To deny a particular user form accessing the secured resources, the web.config file must contain the following code:
<deny users="username" />
48. What are the event handlers that can be included in the Global.asax file?
The Global.asax file contains some of the following important event handlers:
49. What is the difference between page-level caching and fragment caching?
In the page-level caching, an entire Web page is cached; whereas, in the fragment caching, a part of the Web page, such as a user control added to the Web page, is cached.
50. Make a list of all templates of the Repeater control.
The Repeater control contains the following templates:
51. Describe the complete lifecycle of a Web page.
When we execute a Web page, it passes from the following stages, which are collectively known as Web page lifecycle:
52. How can you assign page specific attributes in an ASP.NET application?
The @Page directive is responsible for this.
53. Which method is used to post a Web page to another Web page?
The Respose.Redirect method is used to post a page to another page, as shown in the following code snippet: Response.Redirect("DestinationPageName.aspx");
54. What is a Cookie? Where is it used in ASP.NET?
Cookie is a lightweight executable program, which the server posts to client machines. Cookies store the identity of a user at the first visit of the Web site and validate them later on the next visits for their authenticity. The values of a cookie can be transferred between the user's request and the server's response.
55. What are Custom User Controls in ASP.NET?
The custom user controls are the controls that are defined by developers. These controls are a mixture of custom behavior and predefined behavior. These controls work similar to other Web server controls.
56. What does the .WebPart file do?
The .WebPart file explains the settings of a Web Parts control that can be included to a specified zone on a Web page.
57. How can you enable impersonation in the web.config file?
To enable impersonation in the web.confing file, you need to include the <identity> element in the web.config file and set the impersonate attribute to true as shown in the following code snippet:
<identity impersonate = "true" />
58. How can you identify that the page is PostBack?
The Page object uses the IsPostBack property to check whether the page is posted back or not. If the page is postback, this property is set to true.
59. In which database is the information, such as membership, role management, profile, and Web parts personalization, stored?
The aspnetdb database stores all information.
60. What is State Management? How many ways are there to maintain a state in .NET?
State management is used to store information requests. The state management is used to trace the information or data that affect the state of the applications.
There are two ways to maintain a state in .NET, Client-Based state management and Server-Based state management.
The following techniques can be used to implement the Client-Based state management:
The following techniques can be used to implement Server-Based state management:
61. What do you understand by aggregate dependency?
Aggregate dependency allows multiple dependencies to be aggregated for content that depends on more than one resource. In such type of dependency, you need to depend on the sum of all the defined dependencies to remove a data item from the cache.
62. How can you ensure that no one has tampered with ViewState in a Web page?
To ensure that no one has tampered with ViewState in a Web page, set the EnableViewStateMac property to True.
63. What is the difference between adding items into cache through the Add() method and through the Insert() method?
Both methods work in a similar way except that the Cache.Add() function returns an object that represents the item you added in the cache. The Cache.Insert() function can replace an existing item in the cache, which is not possible using the Cache.Add() method.
64. Explain the cookie less session and its working.
ASP.NET manages the session state in the same process that processes the request and does not create a cookie. It is known as a cookie less session. If cookies are not available, a session is tracked by adding a session identifier to the URL. The cookie less session is enabled using the following code snippet: <sessionState cookieless="true" />
65. What is a round trip?
The trip of a Web page from the client to the server and then back to the client is known as a round trip.
66. What are the major built-in objects in ASP.NET?
The major built-in objects in ASP.NET are as follows:
67. Where should the data validations be performed-at the client side or at the server side and why?
Data validations should be done primarily at the client side and the server-side validation should be avoided because it makes server task overloaded. If the client-side validation is not available, you can use server-side validation. When a user sends a request to the server, the validation controls are invoked to check the user input one by one.
68. Why do we need nested master pages in a Web site?
When we have several hierarchical levels in a Web site, then we use nested master pages in the Web site.
69. How can you dynamically add user controls to a page?
User controls can be dynamically loaded by adding a Web User Control page in the application and adding the control on this page.
70. What is the appSettings Section in the web.config file?
The web.config file sets the configuration for a Web project. The appSettings block in configuration file sets the user-defined values for the whole application.
For example, in the following code snippet, the specified ConnectionString section is used throughout the project for database connection:
<add key="ConnectionString" value="server=indiabixserver; pwd=dbpassword; database=indiabix" />
71. What type of code, client-side or server-side, is found in a code-behind file of a Web page?
A code-behind file contains the server-side code, which means that the code contained in a code-behind file is executed at the server.
72. To which class a Web form belongs to in the .NET Framework class hierarchy?
A Web form belongs to the System.Web.UI.Page class.
73. What does the "EnableViewState" property do? Why do we want it On or Off?
The EnableViewState property enables the ViewState property on the page. It is set to On to allow the page to save the users input between postback requests of a Web page; that is, between the Request and corresponding Response objects. When this property is set to Off, the page does not store the users input during postback.
74. Which event determines that all the controls are completely loaded into memory?
The Page_Load event determines that all the controls on the page are fully loaded. You can also access the controls in the Page_Init event; however, the ViewState property does not load completely during this event.
75. What is the function of the CustomValidator control?
It provides the customize validation code to perform both client-side and server-side validation.
76. What is Role-based security?
In the Role-based security, you can assign a role to every user and grant the privilege according to that role. A role is a group of principal that restricts a user's privileges. Therefore, all the organization and applications use role-based security model to determine whether a user has enough privileges to perform a requested task.
77. Which data type does the RangeValidator control support?
The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date.
78. What are the HTML server controls in ASP.NET?
HTML server controls are similar to the standard HTML elements, which are normally used in HTML pages. They expose properties and events that can be used programmatically. To make these controls programmatically accessible, you need to specify that the HTML controls act as a server control by adding the runat="server" attribute.
79. Why a SiteMapPath control is referred to as breadcrumb or eyebrow navigation control?
The SiteMapPath control displays a hierarchical path to the root Web page of the Web site. Therefore, it is known as the breadcrumb or eyebrow navigation control.
80. Where is the ViewState information stored?
The ViewState information is stored in the HTML hidden fields.
81. Which namespaces are necessary to create a localized application?
The System.Globalization and System.Resources namespaces are essential to develop a localized application.
82. What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?
You can select more than one HtmlInputCheckBox control from a group of HtmlInputCheckBox controls; whereas, you can select only a single HtmllnputRadioButton control from a group of HtmlInputRadioButton controls.
83. What is the difference between HTML and Web server controls?
HTML controls are client-side controls; therefore, all the validations for HTML controls are performed at the client side. On the other hand, Web server controls are server-side controls; therefore, all the validations for Web server controls are performed at the server side.
84. Explain the AdRotator Control.
The AdRotator is an ASP.NET control that is used to provide advertisements to Web pages. The AdRotatorcontrol associates with one or many advertisements, which randomly displays one by one at a time when the Web page is refreshed. The AdRotator control advertisements are associated with links; therefore, when you click on an advertisement, it redirects you to other pages.
The AdRotator control is associated with a data source, which is normally an xml file or a database table. A data source contains all the information, such as advertisement graphics reference, link, and alternate text. Therefore, when you use the AdRotator control, you should first create a data source and then associate it with the AdRotator control.
85. What do you understand by the culture?
The culture denotes a combination of a language and optionally a region or a country. The contents of a Web page of a multilingual Web site are changed according to the culture defined in the operating system of the user accessing the Web page.
86. What is the difference between absolute expiration and sliding-time expiration?
The absolute expiration expires a cached item after the provided expiration time. The sliding time does not expire the cached items because it increments the specified time.