title: Ways to share common functions betweed few pages in ASP.NET
body: <p>This is possibly very lame question and I lack knowledge about ASP.Net. In this case a link to an article explaining would be very welcome.</p>
  
  <p>I'm working on web-site on ASP.NET with C# as codebehind. My current project involves developing few pages with very similar functionality and a many functions are the same. For example </p>
  
  <pre><code>private void PermissionCheck()
  {
      if (null == Session["UserID"] ||
          null == Session["ProjectID"] ||
          null == Session["AssetID"] ||
          null == Session["ProjectName"])
      {
          Response.Redirect("~/Login.aspx");
      }
   }
  </code></pre>
  
  <p>Would be the same on 2 pages. Some other things are the same as well. I would like to put this into common base class. But there are other functions that don't really belong to pages at all: </p>
  
  <pre><code>private string GetAttachmentTempPath()
  {
      return Request.PhysicalApplicationPath + WebConfigurationManager.AppSettings.Get("AttachmentsTempFolder");
  }
  </code></pre>
  
  <p>I would like to move this into <code>Attachment</code> class, but to get the physical path of the application, I need to pass in Request object into that method, which is not really nice, as it  couples <code>Attachment</code> class with <code>Page.Request</code> object. </p>
  
  <p>Is there any way to move these functions somewhere else without needing to pass <code>Page.Request</code> objects around??</p>
  
  <p>p.s. The appliction is huge, and there is no scope to change the entire architecture.</p>