Sunnygurke
Sunnygurke

Reputation: 117

Sharing global variables between two projects

My problem is that i have two projects in a solution (1x ASP, 1x Console) and i want to share some data between them.

I tried it with a static class in the console-app. The problem is that the reference-class in the asp-app is a new one, and if I try to change something in this static class it is only changed in the asp-app but not in the console-app.

Thanks in advance!

Upvotes: 0

Views: 1560

Answers (3)

Sriram
Sriram

Reputation: 1

Store it in registry and access it

Upvotes: -1

Etienne de Martel
Etienne de Martel

Reputation: 36851

The problem you have is that those two projects are going to run as two different processes. The ASP.NET project is going to get run by IIS, and your console project is simply a standard .NET app.

So, you'll need some sort of communication bridge between the two. If they're on the same machine, you could use files or named pipes, and if they're on different machines, you could take advantage of the fact that one of your processes is an ASP.NET web app and use web services. You could also use a database (but that might be overkill depending on your needs).

Upvotes: 3

Nick Randell
Nick Randell

Reputation: 18295

There are lots of approaches to do this, but the most common one is to use a database that is accessed by both processes.

If you could provide more context, it would make this easier to give you an accurate answer.

Upvotes: 1

Related Questions