Asp .Net Interview Question and Answer | Web Application | Session 13

121. Describe the property of cookie in Asp.Net ?
 Ans:  
Properties:
        1. Domain: The domain associated with the cookie for example, aspx.superexpert.com
        2. Expires: The expiration date for a persistent cookie.
        3. HasKeys: A Boolean value that indicates whether the cookie is a cookie dictionary.
        4. Name: The name of the cookie.
        5. Path: The path associated with the Cookie. The default value is /.
        6. Secure: A value that indicates whether the cookie should be sent over an encrypted connection only. The default value is False.
        7. Value: The value of the Cookie.
        8. Values: A NameValueCollection that represents all the key and value pairs stored in a Cookie dictionary.

122. Write the code that creates a cookie containing the user name R4R and the current date to the user computer. Set the cookie to remain on the user computer for 30 days?
 Ans:  
Code:
          HttpCookie cookUserInfo = new HttpCookie("UserInfo");
          CookUserInfo["Name"] = "R4R";
          CookUserInfo["Time"] = DateTime.Now.ToString();
          cookUserInfo.Expires = DateTime.Now.AddDays(30);
          Response.Cookies.Add(cookUserInfo);

 Description:
         "HttpCookie" :The HttpCookie class is under System.Web namespace.
         "CookUserInfo" :is the object of class HttpCookie
         "Expires": is the property that sets the duration,when cookie expire.

123. What do you mean by three-tier architecture?
 
Ans: The three-tier architecture was improve management of code and contents and to improve the performance of the web based applications. There are mainly three layers in three-tier architecture.This architecture remove the many drawbacks of previous Cliet-Server architecture.
         There are three stages in this Architecture;
        (1) Presentation Layer: PL(Presentation Layer) Contains only client side scripting like HTML, javascript and VB script etc.The input Validation validate on Cliet side.
        (2) Business Logic Layer:BL(Business Logic Layer) contain the server side code for data transaction, query and communicate through Data Base,and Pass the data to the user interface.
        (3) Database layer:Data Layer represents the data store like MS Access, SQL Server, an XML file, an Excel file or even a text file containing data also some additional database are also added to that layers.

124. Define ASP.Net page life cycle in brief ? 
Ans: 1. OnInit (Init): Initializes each child control.
          2. LoadControlState: Loaded the ControlState of the control. To use this method the control must call the Page.RegisterRequiresControlState method in the OnInit method of the control.
          3. LoadViewState: Loaded the ViewState of the control.
          4. LoadPostData: Controls that implement this interface use this method to retrieve the incoming form data and update the control According to there properties.
          5. Load (OnLoad): Allows actions that are common to every request to be placed here. control is stable at this time, it has been initialized and its state has been reconstructed.
          6. RaisePostDataChangedEvent: Is defined on the interface IPostBackData-Handler.
          7. RaisePostbackEvent: Handling the clien side event caused Postback to occur
          8. PreRender (OnPreRender): Allows last-minute changes to the control. This event takes place before saving ViewState so any changes made here are saved.
          9. SaveControlState: Saves the current control state to ViewState.
         10. SaveViewState: Saves the current data state of the control to ViewState.
         11. Render: Generates the client-side HTML Dynamic Hypertext Markup Language (DHTML) and script that are necessary to properly display this control at the browser. In this stage any changes to the control are not persisted into
ViewState.
         12. Dispose: Accepts cleanup code. Releases any unman-aged resources in this stage. Unmanaged resources are resources that are not handled by the .NET common language runtime such as file handles and database connections.
         13. UnLoad
 
125. What is ViewState?
Ans: State of the object to be stored in hidden field on the page.ViewState is not stored on the server or any other external source. ViewState transported to the client and back to the server. ViewState is used the retain the state of server-side objects between postabacks.Viewstate should be the first choice to save data to access across postbacks.
 
126. What classes are needed to send e-mail from an ASP.NET application?
Ans: Following Classes use to sent email from ASP.Net application:
         1.MailMessage
          2.SmtpMail 
     Both are classes defined in the .NET Framework Class Library's "System. Web. Mail" namespace.
 
127. Do Web controls support Cascading Style Sheets?
Ans: All Web controls inherit a property named CssClass from the base class "System.Web.UI. WebControls. WebControl" which can be used to control the properties of the web control.


128. What is Data Binding?
Ans: Data Binding is binding controls to data from databases.Using Data binding a control to a particular column in a table from the database or we can bind the whole table to the data grid.
          In other words Data binding is a way used to connect values from a collection of data (e.g. DataSet) to the controls on a web form. The values from the dataset are automatically     displayed in the controls without having to write separate code to display them.

129. Describe Paging in ASP.NET?
 
Ans: "In computer operating systems there are various ways in which the operating system can store and retrieve data from secondary storage for use in main memory". One such memory management scheme is referred to as paging.In ASP.Net the DataGrid control in ASP.NET enables easy paging of the data. The AllowPaging property of the DataGrid can be set to True to perform paging. ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set for PagerStyle.Mode.
 
130. What is the ASP.NET validation controls?
Ans: Validation controls applied on client side scripting.List of Validations:
         1. RegularExpressionValidator:Input value matches a specific pattern.
         2. RangeValidator:Chek the values falls between to values.
         3. CompareValidator:Compares the value of one input control to the value of another input control or to a fixed value.
         4. RequiredFieldValidator:Makes a input control to required field.
         5. CustomValidator:Write a Method to validat input.
         6. ValidationSummary:Displays a report of all validation errors occurred in a Web page.


Previous Next


:: Click the links below for similar type Questions and answers ::

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes