zoukankan      html  css  js  c++  java
  • ASP.NET Client Side State Management

    There are two types of state management - server side and client side. In this post I'm going to introduce the client side state management and explain when to choose client side or server side state management

    Client Side State Management Techniques

    Client side state management include the following techniques:

    • ViewState - ASP.NET track the state of the controls on the pages through
      the ViewState. Also, ViewState is used to store small custom values.
      Don't hold big custom data object because it will affect the performance of
      your web page.
    • Hidden fields - hidden fields are html input control with a type of hidden -
      <input type="hidden">. They are used to store data in the html without presenting
      the data in the browser. The data of hidden field is available when the form is
      processed or when using javascript. The ViewState use hidden field to save its
      data. You can use the View Source operation (if enabled) to scan the web page's
      source and to look for hidden fields.
    • Query strings - query string state is stored in the URL that is sent to the browser.
      Unlike ViewState and hidden fields, the user can see the values without using
      special operations like View Source. The parameters are passed in the URL
      separated by the & symbol.
      For example, in the following URL the query string is built out of two data
      parameters, a and b, which hold the values 1 and 2 - http://www.srl.co.il?a=1;b=2.
    • Cookies - the cookies store their values in the user's browser and the browser
      send them back to the server every time a request is performed.
      Cookies are maintained during the session of a user in the web site and therefore
      can be used in multiple web pages of the site.
    • Control state - when building custom controls you should use the control state
      to save your state if EnableViewState property is set to false.
      This is the only reason to use this technique.

    How do you know when to choose the client side or server side state management?

    When to Choose Client Side State Management

    Choose client side for better scalability and support multiple servers. The client side helps to get better scalability by storing state data in the user's browser instead of using the web server's memory. The client side support multiple servers because all the state is located in the browser. This way when you are redirected to another server you don't need to worry about your state.

    The thing I wrote doesn't means that you can't use server side state management for the supporting of multiple server. To enable server side state management to be able to support multiple servers you'll have to use centralized state management (state server or store state in database) or you'll have to use techniques like sticky
    connection for load balancing.  

    When to Choose Server Side State Management

    Choose server side for better security and to reduce bandwidth and web page's size. Server side state management is more secure. The state is saved on the server and therefore isn't delivered to the client.
    Confidential state data shouldn't be used with client side state management. Server side reduce the traffic to and from the client because data isn't sent to the browser and it's saved on the server. You should always remember that using client side state management sends data to the user's browser and that data is sent back to the server
    every time. This situation increases bandwidth usage and therefore your application will be less responsive and you'll suffer from performance issues.

    In the next post I'll drill down into the client side techniques and explain how to use them.

  • 相关阅读:
    网页速度分析:PageSpeed Insights (by Google)
    Win10下Jenkins服务是系统账户导致无法使用用户的私有环境变量
    部署Pod非Running状态,describe查看显示node资源不足
    kubernetes部署Pod一直处于CrashLookBackOff状态
    kubernetes部署的Pod长时处于ContainerCreating状态
    VMWARE用OVF文件方式导入报错:Error importing OVF: Failed to open disk: /var/lib/docker/vmwareOVF/Centos_7_64-bit-disk2.vmdk. Reason: The file specified is not a virtual disk
    VMWARE用OVF文件方式导入报错:Error importing OVF:SHA digest of file CentOS_7_64-bit-file1iso does not match manifest
    Linux系统ssh到其它服务器时间延迟长
    Linux系统服务器重启后进入到急救模式
    linux系统内存使用率飙高到90%
  • 原文地址:https://www.cnblogs.com/known/p/1328553.html
Copyright © 2011-2022 走看看