ASP.NET

How to store custom objects in a View state using VB.NET

Software developer can store custom objects in a view state just as easily as regular types. However, to store an item in a view state, ASP.NET must be able to convert it into a stream of bytes. This process is called serialization. If developer’s objects aren’t serializable, he will receive an error message when he attempts to place …

Learn more

How to store custom objects in a View state using C#

Software developer can store custom objects in a view state just as easily as regular types. However, to store an item in a view state, ASP.NET must be able to convert it into a stream of bytes. This process is called serialization. If developer’s objects aren’t serializable, he will receive an error message when he attempts to place …

Learn more

How to preserve member variables for an ASP.NET page in VB.NET

Software developers can follow the next basic principle. They can save all member variables to view state when the Page.PreRender event occurs and retrieve them when the Page.Load event occurs. The Page.Load event happens every time the page is created. In case of a postback, the Load event occurs first, followed by any other control events. The next …

Learn more

How to preserve member variables for an ASP.NET page in C#

Software developers can follow the next basic principle. They can save all member variables to View state when the Page.PreRender event occurs and retrieve them when the Page.Load event occurs. The Page.Load event happens every time the page is created. In case of a postback, the Load event occurs first, followed by any other control events. The next …

Learn more

How to encrypt View state for an individual page when it is requested

Software developer can encrypt an individual page only if a control specifically requests it using ViewStateEncryption-Mode property of the Page directive:

<%@Page ViewStateEncryptionMode=”Auto”>

The developer can set the same attribute in a configuration file:

<configuration xmlns =https://scemas.microsoft.com/.NetConfiguration/v2.0>
    <system.web>
        <pages viewStateEncryptionMode=”Auto”>
        …
    </system.web>
</configuration>

Note: Encryption imposes a performance penalty, because the web server will perform the encryption and decryption with each postback.  Don’t encrypt view state …

Learn more

How to turn off View state encryption for an individual page

Software developer can turn off encryption for an individual page using ViewStateEncryption-Mode property of the Page directive:

<%@Page ViewStateEncryptionMode=”Never”>

The developer can set the same attribute in a configuration file:

<configuration xmlns =https://scemas.microsoft.com/.NetConfiguration/V2.0>
    <system.web>
        <pages viewStateEncryptionMode=”Never”>
        …
    </system.web>
</configuration>

Related TutorialsHow to use the SiteMapPath navigation control in ASP.NET
How to populate the TreeNode objects in ASP.NET in VB.NET
How to search XML content with XPath in VB.NET
How …

Learn more

How to turn on View state encryption for an individual page

Software developer can turn on encryption for an individual page using ViewStateEncryption-Mode property of the Page directive:

<%@Page ViewStateEncryptionMode=”Always”>

The developer can set the same attribute in a configuration file:

<configuration xmlns =https://scemas.microsoft.com/.NetConfiguration/V2.0>
    <system.web>
        <pages viewStateEncryptionMode=”Always”>
        …
    </system.web>
</configuration>

 

Note: Encryption imposes a performance penalty, because the web server will perform the encryption and decryption with each postback.  Don’t encrypt view state if you don’t need to …

Learn more

How to use ViewState in VB.NET

You as software developer can use code to add information directly to the view state collection of the containing page and recover it later after the page is posted back. The type of information you can store includes not only the simple data types, but your custom objects too.   The view state collection is provided by ViewState property …

Learn more