Questions tagged [httpapplicationstate]

Use this tag for questions related to the state of an HTTP application.

is used along with C# and ASP.NET, and it's a class that enables the sharing of a variety of informations across multiple sessions and requests.

12 questions
3
votes
2 answers

Can multiple users share an HttpApplication instance?

I've used the table at the top of this article as a reference. I have three questions: 1 - Can multiple users (from different physical locations) ever share an HttpApplication instance? If so, does this happen by default? 2 - Can multiple users…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
3
votes
2 answers

HttpContext.Current.ApplicationInstance.Application vs HttpContext.Current.Application

If I want to store some Objects to share across pages and session which one should I use? HttpContext.Current.ApplicationInstance.Application or HttpContext.Current.Application. I was using HttpContext.Current.Application but just got confused…
TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
2
votes
2 answers

Can't seem to set object when mocking HttpApplicationState with Moq

I have an action filter which is setting an object in the HttpApplicationState of the HttpContext of the filter context. I would like to have this functionality in a unit test but for some reason the object is not being set in the underlying…
John Dough
  • 23
  • 3
2
votes
2 answers

Is HttpApplicationState.RemoveAll() thread safe?

In my asp.net application, i want to cache some data in the HttpApplicationState. My code to set the data looks like this: Application.Lock(); Application.Set("Name", "Value"); Application.UnLock(); When I read the documentation, it says that…
Learner
  • 4,661
  • 9
  • 56
  • 102
1
vote
1 answer

Can Application property of HttpApplication class be used to calculate current Active Users?

I am using the following code in the ASP.NET web forms Global.aspx page to count the number of current active users. It does work when I do local testing. Understanding is that Application is an Application-level variable and can be accessed at the…
Nithin B
  • 601
  • 1
  • 9
  • 26
1
vote
1 answer

Find Number of visitors for a site in ASP.NET MVC using C#

I am trying to find number of visitors for a site using Application. My Global.asax.cs looks like this: public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { …
Santosh
  • 2,355
  • 10
  • 41
  • 64
1
vote
0 answers

Cannot access HttpApplicationState in Web API controller

I have a REST API application made with .NET Core 2.0. I would like to access the Application property to store some global settings for all the application. However, it doesn't seem to be available in any of my controllers using System; using…
1
vote
2 answers

c# .net in-memory persistence

I would like to have a "user message" available for every request sent back by the server. If there is not a user message, the message goes back blank. If there is one, an icon is activated on each user screen after their request is…
horace
  • 938
  • 9
  • 20
0
votes
0 answers

Garbage collection of global Application object in ASP.NET MVC C#

I have ran into a problem where a long running singleton added to HttpApplicationState which does some data masking (GDPR), stops masking data after running in the background for some time. It's hard to debug because it only happens in our UAT…
0
votes
2 answers

HttpApplicationState using IIS

I've been given a task to create a browser-based POS application which is going to be hosted using a Windows IIS server on one PC. Several other PCs and tablets will access the functions of the application by entering the IP of the PC hosting it in…
Nathangrad
  • 1,426
  • 10
  • 25
0
votes
1 answer

Why do we need StaticObjects collection when HttpApplicationState can be handled by HttpContext

i just read we can access HttpApplicationState using Application or StaticObjects I am not clear as why we need two different approach as all i can see is Application will help you to add and read in the code level while using staticobjects we can…
0
votes
2 answers

HttpApplicationState outside of the Web Project (Class Library)

I've got an ASP.net web application that relies on a separate DLL class library project for its business logic. However, I'd like to use the global HttpApplicationState in the DLL project. But that seems to be a web project-specific…
Tim C
  • 47
  • 1
  • 7