Friday 6 June 2014

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.

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" />

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.

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.

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.

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");

How can you assign page specific attributes in an ASP.NET application?

The @Page directive is responsible for this.

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:

  • Page request - During this stage, ASP.NET makes sure the page either parsed or compiled and a cached version of the page can be sent in response
  • Start - During this stage sets the Request and Response page properties and the page check the page request is either a postback or a new request
  • Page Initialization - During this stage, the page initialize and the control's Unique Id property are set
  • Load - During this stage, if the request is postback, the control properties are loaded without loading the view state and control state otherwise loads the view state
  • Validation - During this stage, the controls are validated
  • Postback event handling - During this stage, if the request is a postback, handles the event
  • Rendering - During this stage, the page invokes the Render method to each control for return the output
  • Unload - During this stage, when the page is completely rendered and sent to the client, the page is unloaded. 

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:

  • Application_Error
  • Application_Start
  • Application_End
  • Session_Start
  • Session_End

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:

<authorization >
<deny users="username" />
</authorization>