httpruntime

Locking HttpRuntime.Cache for lazy loading

We have a website running .NET 2.0 and have started using the ASP.Net HttpRuntime.Cache to store the results of frequent data lookups to cut down our database access. Snippet: lock (locker) { if (HttpRuntime.Cache[cacheKey] == null) { HttpRuntime.Cache.Insert(cacheKey, GetSomeDataToCache(), null, DateTime.Today.AddDa...

ASP.NET MVC and httpRuntime executionTimeout

I would like to increase the httpruntime executionTimeout for a subsection of an ASP.NET MVC application. In a regular Web App, you could use <configuration> <location path="UploadPage.aspx"> <httpRuntime executionTimeout="600"/> </location> </configuration> however there really is not the idea of "Folders" in ASP.NET MVC, so how wo...

How to prevent an ASP.NET application restarting when the web.config is modified?

I'm hosting the ASP.NET runtime via the ApplicationHost.CreateApplicationHost method. When I modify the web.config while the application is running, i see lots of first chance ThreadAbortExceptions thrown. This is right before my application comes crashing down. I'm assuming this is because the runtime has detected changes to the configu...

HttpRuntime..cctor takes forever to execute

Dead simple code: using System; using System.Diagnostics; using System.Web; using System.Web.Caching; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Stopwatch sw = Stopwatch.StartNew(); Cache cache = HttpRuntime.Cache; Console.WriteLine(sw.El...

Issue with Callback method and maintaining CultureInfo and ASP.Net HttpRuntime

Hi All, Here is my issue. I am working on an E-commerce solution that is deployed to multiple European countries. We persist all exceptions within the application to SQL Server and I have found that there are records in the DB that have a DateTime in the future! We define the culture in the web.config, for example pt-PT, and the forma...

WCF Service hosted in IIS - Can't seem to cache or retain state?

Hello, I'm trying to cache some application data that only needs to be instantiated when the application starts. I've tried using HttpRuntime.Cache, creating a static object that is instantiated only when the service starts, and I've tried making the service singleton and using global variables. Every time a new request hits the servic...

What is the lifespan of the HttpRuntime Cache (any simple alternative?)

I have been using the HttpRuntime Cache for caching simple user preferences on an in house [dasboard] asp.net app that gets used by almost 200 users daily. I simply cache stuff such as the last query conditions, scales, options (just checkboxes dependent on other checkboxes etc.) just so that when a user closes the browser, they will be...

Ajax AsyncFileUpload.FileBytes returns null

I have a file upload page with an AsyncFileUpload control. When the user browses to the file the upload control pulls the file into memory. I then have an Upload button which fires the following code to save the file to a database. I am finding that if files are over about 500KB then the FileBytes property of the control simply returns ...

Configuring httpRuntime execution timeout for large downloads

At my place of work, we have an ASP.NET page that uses the following code to perform a file download. We use this rather than Request.TransmitFile() because the file is coming directly from a zip archive. private void DownloadStream(Stream stream) { int bytesRead; int chunkSize = 1048576; //1MB byte[] re...

C# Unit Test set HttpRuntime.BinDirectory

I've got a clear and simple question. The webapplication i'm working on is using unit tests (close to 1500 tests). Due to an required modification in the application several tests are failing because The HttpRuntime.BinDirectory doesn't have a value and therefor throws and ArgumentNullException. Is there a way to set my own value in Htt...