.Net Interview Questions And Answers


Home ASP.Net & C#
MVC
Others

In this blog, I will share some ideas, tutorials, Interview questions and Answers for .net Programmers. There are a lots of articles and Interview questions which I am preparing and is not completed yet. So please view the blog continuously to get all the updates :) 

Search : 

1. What is state management in ASP.Net
         State management means preserving the state of the page, controls, objects, user etc while we are moving from one page to another or a post back happens.

2. Why we need state  management in Asp.net
         Data is transferred from server to the browser over HTTP. HTTP is a stateless protocol. Stateless means, state of the web page, controls are lost once we post the page from client to the server.It is important to save the state of the controls in a page after the page is post back.
         For example I have one 1 text box for entering the "Employee Name" and one submit button for saving the "Employee Name". When click on the submit button, data is posted back to the server and data is processed at the server side. Since HTTP is stateless, it will not keep the value in the text box (Emplyee Name) after the postback. Here, for maintaining the value in the textbox after post back we need to use state management techniques.

3. What are the different types of state management in ASP.Net
         There are 2 types of state management techniques
  • Server Side
  • Client Side

4. What are the different types of Client side state management in ASP.Net
  • View State
  • Hidden Field
  • Cookies
  • Control State
  • Query Strings
5. What are the different types of Server side state management in ASP.Net
  • Session
  • Application
6. From the list below, which is the control for which by default post back is         enabled.
  • button
  • textbox
  • listbox
  • gridview
     Ans - Button ( By Default button control have post back is enabled )

7. What are the Advantages and Disadvantages of using view state for state         management 
        
     Advantages
  • View state is easy to implement. We can easily enable or disable view state at the page level or at the controller level
  • They are not using any server side resources. It is stored in the client side browser in a hidden field.
  • View state is secure because it stores the data in encrypted format.
  • It is good with HTTP data transfer      
     Disadvantages
  • View state information cannot transfer across pages automatically.
  • If the view state information is very large, it may cause the page load/ post back to be slow.
  • Mobile devices might not have the enough memory capacity to store a large view state data.
8. What are the Advantages and Disadvantages of using Hiddenfield for state management ?

     Advantages

  • Hidden fields are standard HTML controls and it does not require any complex programming logic.
  • Almost all the browsers supports hidden field.
  • The hidden field can be stored and read from the page.
     Disadvantages
  • Hidden field value is stored in the page itself and can directly view the content if we view the page source. This is potential security issue.
  • Hidden field value is stored in the page. Storing big values make the page load/ post back to be slow.
  • Hidden field stores value in the string format and it does not support rich data types. So we need to use custom logic ( like implement delimited strings) for storing multiple values
9. What are the Advantages and Disadvantages of using Session for state management ?

     Advantages
  • Easy to implement
  • Accessing the data is fast since it is stored in memory
  • Complex data types can be stored in session without serialization
  • When we are using out proc mode, session data can be shared across servers and will not lose the data even the IIS or worker process restarts.
     Disadvantages
  • Since it is stored in the memory, storing large data will impact the performance.
  • When we are using in proc mode, IIS restart or worker process restart will cause the data to be lost.
  • Web garden or Web farm cannot use the session state when using In proc mode
10. What are the Advantages and Disadvantages of using Query String for state management ?

     Advantages
  • Easy to use
  • Supported by almost all the browsers
  • No extra effort is needed to code
     Disadvantages
  • Since the query string values are appended at the end of url, it is easy to view by the users - Which is a security breach
  • Most of the browsers specify a maximum limit on the characters in the query string ( In IE, it is 2083 characters)



No comments:

Post a Comment