title: Passing a value from one function to another
body: <p>I'm attempting to pass the value of a variable generated in the Button1 click event in a try { } to another function (function2).  What is the most efficient way to do this?  A Session object?</p>
  
  <pre><code>private static string createAuthCode()
  {
      RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
      byte[] buff = new byte[5];
      rng.GetBytes(buff);
      return Convert.ToBase64String(buff);
  }
  
  protected void Button1_Click(object sender, EventArgs e)
  {
      //code
      //..
      try {
      ...
      string authCode = createAuthCode();
      }
      //code
      //..
      function2();
  }
  
  protected void function2()
  {
      //I want to access authCode here
  }
  </code></pre>