I have to use cache multiple forms data that will be submitted on last form. I m not getting how to handle cache key as it should be unique. I want to use this key to get and put data in different forms. I considered to use GUID but it is very long to put in query string.
How generate the unique no. 1,2,3 and so on .... on button click of each new user ..
the code mentioned below is a readwrite coding in vb.net ...
but the problem is it generate the same id for different users on button click event... but i want the no. of times button clicked the new ids will be generated
We have a wfc layer that wraps the business classes and database access and use a client that lives on the database layer. Amongst our group we are attempting to form standards. Some want to have the client call the web method and pass the page they are requesting and the page size. Pass that to the database and then page in SQL Server use RowNum.Some want to cache the full list of objects in http cache on the service tier and page in memory. They concern here is memory use on the server.
Which would be best for a medium number of users with potentially large number of records to manage (say 30K) Is it better to cache them all in memory and work from there or page at the database as the application scales?
Since I don't want my sessions to be removed unless the session has been abandoned either via code or Session Timeout...For eviction, I would think "None" and for expireable, I would think False.I have tested and calling Session.Abandon does remove the object from the cache. I have also tested to see if by extending my session, the session object in cache is also extended. This does seem to work the "correct" way.
We have a data driven ASP.NET website which has been written using the standard pattern for data caching (adapted here from MSDN):
public DataTable GetData() { string key = "DataTable"; object item = Cache[key] as DataTable;
[code]...
The trouble with this is that the call to GetDataFromSQL() is expensive and the use of the site is fairly high. So every five minutes, when the cache drops, the site becomes very 'sticky' while a lot of requests are waiting for the new data to be retrieved.
What we really want to happen is for the old data to remain current while new data is periodically reloaded in the background. (The fact that someone might therefore see data that is six minutes old isn't a big issue - the data isn't that time sensitive). This is something that I can write myself, but it would be useful to know if any alternative caching engines (I know names like Velocity, memcache) support this kind of scenario. Or am I missing some obvious trick with the standard ASP.NET data cache?
we have so many parameters that the cache key is several hundred characters long. is there a limit to the length of these cache keys? Internally, it is using a dictionary, so theoretically the lookup time should be constant. However, I wonder if we have potential to run into some performance/memory problem.
I have use Nhibernate in my MVC Project by me known, Nhibernate have cache on Session and Object. now, I want use HttpContext.Current.Cache (system.web) for cache data something in project. my code same that have problem, haven't it. and that's right or wrong.
I've got a web application that runs of a state server. It looks like soon it may need to distributed and there will be two web servers behind a load balancer.
This works great for session state but my next challenge is Cache
My application leverages heavily of cache. I understand ASP.Net 4.0 will be offering more here but nothing much has been said about the how too.
There are two challenges that I face
1). Each webserver will have its own copy of cache whereas it would be more efficient to put this to a third server the same as session state is put to state server.
2). The real challenge is keeping cache in sync if a simple dataset derived from the database is changed my code dumps that cache item and reloads the cache. That's all well on one webserver but webserver number two wont know to drop that particular cache item and reload it. This could cause some unexpected problems in the application.
For scenario number 2 I could attempt to do some smart coding so server number two knows to dump the cache and reload it.
My guess is someone else has already been here before and there's probably a better implementation approach rather than writing extra code.
Does anyone know how I could achieve the goal of keeping Cache in sync between multiple webservers or even better farm Cache management to another server?
I need to enable caching in my asp.net application, but I do not want to use the webserver's memory for holding cache objects. If I add the page directive for output caching will the page be stored in the asp.net cache object?
I want to be able to maintain certain objects between application restarts.
To do that, I want to write specific cached items out to disk in Global.asax Application_End() function and re-load them back on Application_Start().
I currently have a cache helper class, which uses the following method to return the cached value:
return HttpContext.Current.Cache[key];
Problem: during Application_End(), HttpContext.Current is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[] to retrieve any of the items to save to disk.
Question: how can I access the cache items during Application_End()?
I am here with a task to generate a unique no of specific length from another unique no.
I want my target unique no of say z length to be generate from combination of a unique no [ that may be a serial no ] of say x length and any secret key of say y length.
Im building a image gallery which reads file from disk, create thumbnails on the fly and present them to the user. This works good, except the processing takes a bit time.
I then decided to cache the processed images using the ASP .NET Application Cache. When a image is processed I add the byte[] stream to the cache. As far as I know this is beeing saved into the system memory. And this is working perfect, the loading of the page is much faster.
My question is if there are thousands of images which gets cached in the Application Cache, will that affect the server performance in any way?
You know I have the way to Cache the data I've got from the SQL Server over data caching. In addition I can output cache web user controls.Whats about a web user control contains data from a SQL database? Does it make sense to cache the data and also cache the control?What is the best solution for the combination of these two components?
I am creating a web page that will pretty much persist - no postbacks - using jQuery.
I'm going to talk to the page with web services.
So I was thinking that when the user first gets the webpage I give them a GUID that they have to pass back to me with every future call to web services.
I'll simply save the GUID in a table in my MS SQL database and by grabbing that record from the db I could potentially get all my user specific data - user id - permission levels - whatever.
I can make the session row expire after like 10 hours - or something like that - so that they don't get the same session tomorrow simply by forgetting to close the browser window at the end of the work day. ..
I've half written an app which has just one model for adding and editing a particular entity.I am trying to embrace modelmetadata and where possible reduce my form code to just calls for EditorForModel. One of the key issues I am having it managing the differences between a add and update scenario.
Take "User" editing for example, in an Add scenario I want "Password" to be a required field, in an update scenario I dont' want it to be a required field. The model-centric approach would have me create two models, one for adding and one for editing. My edit model wouldn't have the Required attribute on the Password field. My feeling is this is going to create a bit too much plumbing.
Besides having a rather massive amount of automapping going on there is another more irrititating issue. Strongly typed views. I could... maybe see my way to having a different model for create and edit, using inheritance i could.. maybe mitigate the amount of code required. What I can't abide is having to have two seperate views, as I have already coding myself into a wall with strongly typed views I couldn't share add and edit (based on my understanding) scenarios with one view.
So anyway I was wondering what other peoplle are doing to manage this? Working with an outsourced (Indian) developers it would be great to make use of EditorForModel as I want them writing as little code as possible.
Currently we are using WebFormsMVP to allow better testability in our project. The framework does presenter binding in OnInitComplete and relies heavily on DataBind expressions e.g.
As i understand above article this would put Model.FirstName into ViewState. Because databinding happens late during page lifecycle when viewstate tracking is already enabled.
One option would be to disable ViewState altogether. Are there any other? Remeber, we can't use OnInit or OnInitComplete, because OnLoad is the first event presenters can handle.
There have been many question on managing EntityContext lifetime, e.g. http://stackoverflow.com/questions/813457/instantiating-a-context-in-linq-to-entitiesI've come to the conclusion that the entity context should be considered a unit-of-work and therefore not reused. But while doing some research for speeding up my database access, I ran into this blog post...Improving Entity Framework PerformanceThe post argues that EFs poor performance compared to other frameworks is often due to the EntityConnection object being created each time a new EntityContext object is needed.
To test this I manually created a static EntityConnection in Global.asax.cs Application_Start(). I then converted all my context using statements to using( MyObjContext currContext = new MyObjeContext(globalStaticEFConnection) { .... }
This seems to have sped things up a bit without any errors so far as far as I can tell.But is this safe?Does using a applicationwide static EntityConnection introduce race conditions?
I have a server control that I developed which generates navigation based on a third party CMS API. Currently I am caching this control using the PartialCaching attribute. The CMS uses cache key dependencies to invalidate the cache when a user makes an edit, however in the case of my server control it does not get invalidated and the updated navigation will not show up until the cache expiration set by the PartialCaching attribute.Here is my two part question:
What is the proper way to programmatically cache a server control, without using the PartialCaching attribute, and adding a cache key dependency?
Is it possible to continue to use the PartialCaching attribute and add a cache key dependency?
I am part of a development team building a new ASP.NET 3.5 web application. Two of us are C# coders, and the other is a VB.NET coder.
I know that we can mix languages on a per-project basis, and one can build classes in one language that inherit from classes written in the other language in a different project (which we are already doing), but I can see us getting into a situation where we might well end up with cyclic dependencies between our various project DLLs.
Other than simply having a high number of projects (more seperation of concerns into more libraries), how have you managed this situation on your own projects?
Note - I believe this question to be different enough from the only similar match I could find (this one) on the basis that we are not wanting to use different languages in order to take advantage of their specific features per se, but rather to make use of what developer resource is available to us (i.e. one dev just happens to be VB.NET only).
With VS2010's mandate that web.config be included in the project, how do we allow everyone to keep their own custom config file without getting into source control problems?
Previously, we would simply leave web.config out of our project, allowing everyone to keep their own local version of web.config on their machine. We moved to VS2010, and it is now forcing me to add web.config to my project in order to run debug mode. Because our project is linked to TFS, it automatically adds web.config to source control and tries to maintain it that way.Is there a way to run in debug mode without including web.config in your project? Or is there a better way to manage config files?