.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to determine HttpRunTime.Cache runtime size

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :.NET Framework

Hi guys,

How do we get/measure the memory consumption of the cache in System.Web.HttpRunTime.Cache class in c#. I need to know the size of the cache at a certain interval in order to flush the cache to prevent cache from hogging too many resources. I understand there's absoluteExpiration, slidingExpiration, cacheDependencies but those doesn't fit into my use case.

Thanks in forward,

View Complete Post

More Related Resource Links

Log Cache Page size

Hello: trying to get more details about Log Cache. i am aware that Data page size is 8KB. want to know the size of page in Log Cache, as i am not able to see that inofrmation in BOL & at MSDN. Any link or pointer is highly appreciated. Thanking in advance. Thanks

HttpRuntime.Cache problem

I'm using the code below (a shortened version as a test). It is invoked on application start and collects data for use by the individual sessions.  The problem I'm having is it doesn't work on one machine but is fine on the other Is using .Clone the correct way of caching or is that the cause of my problems?   Public Shared Sub LoadGroups()                  Dim arrGroups As New ArrayList          for i = 1 to 100               arrGroups.Add("test" & i) Next        HttpRuntime.Cache("Groups") = arrGroups.Clone       Thread.Sleep(2000)  End Sub 

How would runtime determine which assembly to load?

Hi , How would runtime behave, if I have an assembly with same version number in two different folders on my machine? How to restrict the runtime to read from bin folder only for my specific assembly?        

Blob Cache Event ID 7888 Runtime Exception Thread was being aborted

HI, We have 3WFE and we are getting error Events 788 and 5538 on all three servers at same time. Any thoughts on what is causing this error? Event Type: Error Event Source: Office SharePoint Server Event Category: Office Server General Event ID: 7888 Date:  9/14/2010 Time:  2:31:08 PM User:  N/A Computer: MOSS2007A Description: A runtime exception was detected. Details follow. Message: Thread was being aborted. Techinal Details: System.Threading.ThreadAbortException: Thread was being aborted.    at System.Threading.ReaderWriterLock.AcquireWriterLockInternal(Int32 millisecondsTimeout)    at Microsoft.SharePoint.Publishing.BlobCache.<>c__DisplayClass14.<>c__DisplayClass17.<FetchItemFromWss>b__11()    at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock) For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.   Event Type: Error Event Source: Office SharePoint Server Event Category: Publishing Cache Event ID: 5538 Date:  9/14/2010 Time:  2:31:08 PM User:  N/A Computer: MOSS2007A Description: An error occured in the blob cache.  The ex

Is it possible to determine at runtime when my site is running in the debugger?


Is it possible to determine at runtime when my site is running in the debugger?

I want to use one setting for production and another when I'm running in the debugger.

HttpRuntime.Cache IIS problem?


I get the leisure of debugging someone elses project in which a customer logins and gets their status page. Now this status page shows redeemed information, but the odd thing is if you refresh several times you could possibly get someone elses information. It just happens randomly to, but I would hit F5(refresh) and check it several times and it would be a completely different item and then repeat that it would be back to normal. I did this for about 2-3 minutes and it would be totally random. Now my question is he is using HttpRuntime cache to store this information at login and then retrieving them from HttpContext.Current.Session.  Is there a setting in IIS that could be causing me to get someone elses cached item?

Also there needs to be several numbers stored(up to 4) and pass to a few pages on the site. Is there a more effient way rather than using HttpRuntime.Cache and passing it a array list of a created Class Type?

Problems reconciling design time and runtime size of WPF Canvas


Hi, there I am using Visual Studio 2010. I am having trouble with the calculation of the size of my canvas and the positioning of the objects thereupon.

Please consider the following simplest of XAMLs:

<Window x:Class="test01.MainWindow"



 Title="MainWindow" Height="350" Width="525">

 <Canvas Margin="0">

 <Label Canvas.Left="505" Canvas.Top="310" Content="Label" Height="28" Name="label1" Background="Blue" />

 <Label Canvas.Left="-36" Canvas.Top="310" Content="Label" Height="28" Name="label2" Background="Red" />




1) The margins of the canvas are 0

2) at design time I see no part of either the blue label or the red label overlapping my canvas as displayed in Visual Studio

I am unable to explain why at runtime:

1) I see a portion of the blue label.

What is happening here? How can I get a better grip on the real size of my canvas at design time?


Edit: OK in case it isn't clear, the problem here is that I wou

Interoperability: Runtime Data Sharing Through an Enterprise Distributed Cache


Learn how an enterprise distributed cache can help .NET and Java apps share data at run time, providing high performance and scalability.

Iqbal Khan

MSDN Magazine October 2010

How do I determine the size of a dynamically created set of controls?



How do I determine the size of a dynamically created set of controls?

For example, suppose I have a method that creates a form made up of many TextBlocks, TextBoxes, etc., all contained within a grid and that grid is returned by the method.  I need to determine the size of that grid without adding it to any other controls.

    Grid myForm = myMethodThatReturnsAGrid();

    // Here is where I want to find out the size (height and width) of the grid myForm.

The reason I need the size, mainly the height is to determine if it will fit in what is left of the page of a FixedDocument for a report, and if not, to move it to the next page.




Regards, Robert -- Note: I work on various aspects of one or more programs, working on what is most important at the time. Some questions I ask are on aspects of the program that are not important right now or I'm using a workaround for now. Eventually they'll be high priority again and I'll get back to those answers received and respond accordingly. Those that are high priority get responses very soon. Thanks for your input, it is appreciated.

How do that .Net project runtime determine load which assembly

I have a .Net 2.0 prject , and need call .Net3.5 assembly. If the machine set up .net3.5, it can work;  otherwise it will throw exception. Now I want to prepair two aseembly, .net2.0 and .net3.5. They are same source and IO, but .net2.0 disable some .net3.5 functions. When I found the machine doesn't support .net3.5, I call the .net2.0 aseembly. How do it? 

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.

Determine whether Forms Server is installed on a server

Check whether the Microsoft.Office.InfoPath.Server.dll and FormServer.aspx files are installed on the server.

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Set Custom Paper size in C#.net 3.5


Dear All,

I have to set custom paper size 6X8 inches

plz tell sugest me code how to do it.

in C#.net 3.5

i m using Asp.net 3.5 Crystal report

i have to do it programiticlly



Create new sql table at runtime VB.Net


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.

I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!

Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Binding GridView with SqlDataSource at runtime?


Hi, I want to create a generic page which contains a gridview and sqldatasource. I want to put these two controls on .aspx (C#) page but bind them at runtime. It should have selectcommand, updatecommand, deletecommand and insertcommand. Stored procedures are created for that. Help is needed to make it. Please post some link or code. Regards, ap.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend