0

I created a web app in C# ASP.net Core. I originally used public static variables as global variables. This created a huge problem as users were overiding each others static variables and saving someone elses data. I switched to session variables so everyone had their own global variables.

I am now creating a counterpart mobile app to this web app in Xamarin.Forms. I need to create global variables in Xamarin.Forms. Will static variables in Xamarin.Forms have the same issue in Asp.net Core where the variables can be mismatched between users using the mobile phone app Xamarin.Forms?

I'm guess not because each phone will be holding their static variables as opposed to the web app where the server is spinning up the application for each user.

Thank you.

Trying to create individual user global variables in Xamarin.Forms.

abPP
  • 11

1 Answers1

0

If you use a static variable as a global variable, you will still have the same problem as before.

Our direction to solve the problem should be to store the data you want locally or in a cache server. Of course, a database is also possible.

Related link

save some user data locally on my Xamarin Forms app

I recommend using SQLite or RedisCache.

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Can you please explain how this would still be a problem. The issue before was IIS was storing the static variables everyone was accessing through the web app. In mobile phone environment how could everyone's static variables overlap since the application is on each found individually? – abPP Mar 01 '23 at 22:28