Adsence750x90

Showing posts with label State Management. Show all posts
Showing posts with label State Management. Show all posts

Friday, April 16, 2010

Control State - ASP.NET State Management

State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
Control state is an object comprised of critical view state data that Web server controls need to function, and is contained in a separate object from normal view state information. Control state data is not affected when view state is disabled at the Page level, but requires extra implementation steps to use.

More Reference for ASP.NET State Management Check this  

Thursday, March 12, 2009

How to Get Session In Handler (ashx) Files?

To Access session variable in Handler File

using System;
using System.Web;
using System.Web.SessionState;
public class Handler : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest (HttpContext context)
{
context.Session.Add("SessionName", "SessionValue");
}

public bool IsReusable {
get {
return false;
}
}

}

Tuesday, February 17, 2009

What is ViewState Chunking in ASP.Net - Definition & Solution

What is ViewState Chunking

Size of hidden viewstate have no limit.some poxy and firewalls refuse page loads if they have hidden file have greater than certain size. to solve this problem by viewstate chunking.ViewState Chunking is automatically divide view state multiple field to ensure that no hidden field overcome max size. viewstate chunking is not a method for good performance, its only for some proxys and firewalls.
for viewState chunking u can set the maxPageStateFieldLength attribute of the <>
element in the web.config file
<>
< maxpagestatefieldlength="1024">< / pages >
< /system.web >

Sunday, February 15, 2009

Page Caching in ASP.Net - enable and disable client cache

How to Enable Page output caching in ASP.NET?

ASP.NET provides easier methods to control caching. You can use the @ OutputCache directive to control page output caching in ASP.NET. Use the HttpCachePolicy class to store arbitrary objects, such as datasets, to server memory. You can store the cache in applications such as the client browser, the proxy server, and Microsoft Internet Information Services (IIS). By using the Cache-Control HTTP Header, you can control caching.

Some datas are not requried to reload all time when clint attempting to server. we can save ouput page cache in Client side.



method 1

Take ISS (Inertner Information Service) form machine. select site then take properties then
select HTTP Headers Enable content Exparation. this Set your sites output cache properties



Method 2

we Can add Programmatic
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Declarative method
<%@ OutputCache Duration="60" VaryByParam="None" %>
Turn off Caching
Response.Cache.SetCacheability(HttpCacheability.NoCache);