title: Proper way of using C# global variables in ASP.NET?
body: <p>I am using ASP.NET Web Forms and C# in my application. I have a class file named <code>Global.cs</code>, in which I define variables using <code>set</code> and <code>get</code> properties. I use those variables anywhere on any pages by instantiating that class object.</p>
  
  <p>Here is my <code>Global.cs</code> file:</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Linq;
  using System.Web;
  
  /// &lt;summary&gt;
  /// Contains my site's global variables.
  /// &lt;/summary&gt;
  public static class Global
  {
      /// &lt;summary&gt;
      /// Global variable storing important stuff.
      /// &lt;/summary&gt;
      public static string gDate;
      public static string gMobLength;
      public static string gDateFormat;
      public static string gApplicationNo;
      public static string gBranchNo;
      public static string gMemId;
      public static string gIsEditable="false";
      public static string gLoggedInUserName;
  
  
      public static string ImportantData
      {
          get
          {
              return gDate;
  
          }
          set
          {
              gDate = value;
  
          }
  
      }
      public static string MobileLength
      {
          get
          {
              return gMobLength;
          }
          set
          {
              gMobLength = value;
          }
      }
  
      public static string DateFormat
      {
          get
          {
              return gDateFormat; 
          }
          set
          {
              gDateFormat = value; 
          }
      }
      public static string ApplicationNo
      {
          get
          {
              return gApplicationNo;
          }
          set
          {
              gApplicationNo = value; 
          }
      }
      public static string BranchNo
      {
          get
          {
              return gBranchNo; 
          }
          set
          {
              gBranchNo = value;
          }
      }
  
  }
  </code></pre>
  
  <p>Is this a proper way of using variables throughout the project?  What are the possible pros and cons with this approach and what approach would you guys take for using global variables?</p>