My Blog List
Sponser Link
know more info pls click here
What are the disadvantages of using ViewState?-tech17032012
1. On all page visits, during the save view state stage the Page class gathers the collective view state for all of the controls in its control hierarchy and serializes the state to a base-64 encoded string. (This is the string that is emitted in the hidden __ViewState form filed.) Similarly, on postbacks, the load view state stage needs to deserialize the persisted view state data, and update the pertinent controls in the control hierarchy.
2. The __ViewState hidden form field adds extra size to the Web page that the client must download. For some view state-heavy pages, this can be tens of kilobytes of data, which can require several extra seconds (or minutes!) for modem users to download. Also, when posting back, the __ViewState form field must be sent back to the Web server in the HTTP POST headers, thereby increasing the postback request time.
Is ViewState encoded?
Yes, ViewState is base-64 encoded.
Can you encrypt ViewState of Page?
Yes, we can use the LosFormatter class to encrypt ViewState of Page
Can the HTML controls retian State accross postbacks?
No, by default HTML controls donot retain state accross postbacks.
Can you make HTML controls retain State accross postbacks?
Yes, HTML controls can retain State accross postbacks, if you convert HTML controls to Server Controls. There are 2 ways to convert HTML control to Server Controls.
1. Right click on the HTML Control and then click "Run As Server Control"
Or
2. Set runat="server" attribute for the Control.
Is ViewState supported in classic ASP?
No,ViewState is introduced in asp.net, it was not in classic asp.
When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server.
Is ViewState of one page available to another page?
No, ViewState of a Page is available only in that page. You cannot access ViewState of one page from another page.
Can you programatically store and retrieve data from ViewState?
Yes. In ASP.NET you can programatically store and retrieve data from ViewState.See the example below
//Save the value in ViewState object
ViewState("SomeVar") = txtFirstName.text;
//Retrieve the value from ViewState object
String strFirstName = ViewState("SomeVar").ToString();
Can someone view the Page HTML source and read ViewState?
No. ViewState is base-64 encoded. Hence you cannot read ViewState. If you right click on the Page and View Source you will find __ViewState is base-64 encoded.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
<div id="editable" contenteditable="true"> text text text<br> text text text<br> text text...
-
1. Use exception-handling structures to deal with exceptions within the scope of a procedure. This technique is called structured exception ...
-
The Trace object provides the Write and Warn methods to allow you to write messages to a request’s trace information. The two methods are id...
-
There is a little tool called JSPExecutor that allows you to do just that. The developers (Hendrik Schreiber <hs@webapp.de> & Pet...
-
Let me explain the process; 1. First you should go to your adsense account and grab the code for your adsense ads. 2. For this you sh...
-
Few know that those who have web hosting are at the same time endowed with a free VPN (Virtual Private Network, a very safe connection to t...
-
There are a number of ways to get information about a particular Linux command. Chances are you are using bash shell which is currently the...
-
To check if a URL or an email address is valid, the common solution is regular expressions. For instance, to validate an email address in P...
-
we are running a classified site and the latest ads which are coming to the system is indexed in solr write server in every three minutes. T...
-
open source Apache webserver is well-proven, but can still offer an administrator headaches from timeto time when things don't go quite ...
0 comments:
Post a Comment