473,666 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caching ViewState

Hi all.

I override Page's SavePageStateTo PersistenceMedi um(...) and
LoadPageStateFr omPersistenceMe dium() methods to keep page's ViewState on the
server. Very well documented approach, nothing fancy here. I use my own
custom session implementation for all users who log into the app. Each such
session has its encrypted unique string, blah blah... If I store ViewState
of each request on the server, I have to have a way to find correct
ViewState when user posts back. I didn't invented any weels when I decided
to use a combination of that unique sessionID and a path of requested file.
Together they make a perfect key that uniquely describes the "who" and
"where". Now. I decided to use Cache as a storage for ViewState. It was
working beautifully while I was developing this app on my localhost spending
average 0.003 sec to load and deserialize ViewState from Cache. I was
imitating dozens of concurrent users, etc. Was working. Then I delpoyed this
thing to the remote server (some hosting). On that server very often (every
5th or so request) I had an exception saying something like "corrupted
viewstate, do you use a farm?, blah blah". Hosting company swears they don't
use any farms, just RAID. Then I deployed this app on another remote server.
Same thing. Then I used hard drive to store ViewState there instead of Cache
and everything was back to normal again on all machines except that now it
was spending 0.04 secs to load ViewState. I red some stuff about MachineKey
but they talk about farms and gardens. The average size of one ViewState
encrypted text is 10 - 20 kb. Does size matter? :)

Why Cache scenario works fine on my local host and fails on remote
machines?? I can use Application for this, of course, because I can uniquely
identify a user, but I'd like to use "expiration " feature of Cache wich I'd
have to implement by myself in case of Application.

I would greatly appreciate any kind of help!!

Kikoz.
Nov 18 '05 #1
1 1424
when you use the cache, there is no guarantee that it will be kept. any
constraint on memory will cause the cache to be flushed. on your local box,
you are just running one web site, on the hosting server, there are more
than one, and the cache cannot grow as much.

you can use both, write the file and store in cache. if not in cache , read
from file. you could also store the viewstate in the session.

-- bruce (sqlwork.com)

"Kikoz" <ki***@hotmail. com> wrote in message
news:Oq******** *****@TK2MSFTNG P14.phx.gbl...
| Hi all.
|
| I override Page's SavePageStateTo PersistenceMedi um(...) and
| LoadPageStateFr omPersistenceMe dium() methods to keep page's ViewState on
the
| server. Very well documented approach, nothing fancy here. I use my own
| custom session implementation for all users who log into the app. Each
such
| session has its encrypted unique string, blah blah... If I store ViewState
| of each request on the server, I have to have a way to find correct
| ViewState when user posts back. I didn't invented any weels when I decided
| to use a combination of that unique sessionID and a path of requested
file.
| Together they make a perfect key that uniquely describes the "who" and
| "where". Now. I decided to use Cache as a storage for ViewState. It was
| working beautifully while I was developing this app on my localhost
spending
| average 0.003 sec to load and deserialize ViewState from Cache. I was
| imitating dozens of concurrent users, etc. Was working. Then I delpoyed
this
| thing to the remote server (some hosting). On that server very often
(every
| 5th or so request) I had an exception saying something like "corrupted
| viewstate, do you use a farm?, blah blah". Hosting company swears they
don't
| use any farms, just RAID. Then I deployed this app on another remote
server.
| Same thing. Then I used hard drive to store ViewState there instead of
Cache
| and everything was back to normal again on all machines except that now it
| was spending 0.04 secs to load ViewState. I red some stuff about
MachineKey
| but they talk about farms and gardens. The average size of one ViewState
| encrypted text is 10 - 20 kb. Does size matter? :)
|
| Why Cache scenario works fine on my local host and fails on remote
| machines?? I can use Application for this, of course, because I can
uniquely
| identify a user, but I'd like to use "expiration " feature of Cache wich
I'd
| have to implement by myself in case of Application.
|
| I would greatly appreciate any kind of help!!
|
| Kikoz.
|
|
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
3412
by: olle | last post by:
Hi folks. I learning asp.net and compare it with traditional asp and Access-developing. The issue is this one: 1/I have this Ms Acceess adp-project application that works fine on my Ms Sql server database. In my main form I have an Access-combobox with Customer-names from my customer table. In this combo-box are about 2000 records.
6
1906
by: Hypo | last post by:
Im relatilvly new to a web programming in general, and here's the situation i have: I have a default page with dynamic content, and one button with onclick code something like this: { // do some processing... Serever.Transfer("second_page.aspx"); // or Response.Redirect("second_page.aspx"); same in
1
1438
by: DJ Dev | last post by:
Basically, I have a web app which has a step-by-step flow. So the user fills a form, hits next and is taken to the next page, where the user enters more information in form. There are around 5 steps for the user to complete. Each step is on a different page. The problem is that at any point the user should be able to go back and see what he has filled in the previous screens. How should this be achieved? Should I cache (at client?) the...
2
1128
by: Mark Whitton | last post by:
Hi, I am developing using ASP.Net using SQL Server and also have several layers in between, eventually producing a custom business object that is used to populate the web form. I don't use datasets because of performance issues and also they just aren't proper business entities. When it comes to updating my database I generally use an identity value and a datetime value to avoid multiple updates. e.g. Update Customers set ..... where...
0
1196
by: Chris | last post by:
I've been playing with the fragment caching and it seems to work fine. I have a user control that I set to cache. The user control has a few text boxes and a drop down list box populated from a table. When I turn caching on I find there to be a problem with viewstate. Each of the controls have viewstate enabled, but it appears that viewstate does not retain or insert the user's inputed or selected values back into the text boxes or...
8
1602
by: clintonG | last post by:
I've got a big fat cow -- a wiazrd control with 19 steps -- and I need to put Bessie back in the barn. I need to learn how to cache the Viewstate for this page and maintain state should the user hit the browser's back button. I'm looking around of course but ask what are your favorite tutorials for this objective? <%= Clinton Gallagher
17
3242
by: Fred Nelson | last post by:
Hi: I have written several web applications that obtain their connection strings from the web.config file. This is very easy to use and it makes it easy to move an app from development into production. I'm in the process of writing a site that will have lots of traffic so I'm trying to save resources everyplace that I can. My question is - do the web.config app settings get loaded once when the
2
1116
by: JJ | last post by:
If I were to use Caching for a dropdownlist can I disable viewstate for this control? Would I lose control behavior like selectedIndex etc.? I would think since my ddl has like 50+ rows in it and they don't change once the ddl is populated that this control would be an ideal candidate for Caching, agreed? Thanks, JJ
1
1587
by: =?Utf-8?B?YWJjZA==?= | last post by:
My application is using ASP.NET 3.0 and My ASPX pages contain Master page, and content page. The content page (.aspx) has various User controls (ascx). My page view state is significantly large and I am looking for some smart way to rfeduce the page size. So I indentified to manipulate ViewState. When page is posted I will park the ViewState on Server and viewState will not move back and forth. I am doing code as below in Page level by...
0
8444
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.