title: Mixing asmx with CodeBehind
body: <p>I wish to include version information in an asmx file (as opposed to a web.config) such that I can edit the version number without recompiling.  Is there a clean way to accomplish this?  I did come up with a way to do it, but it's pretty horrifying:</p>
  
  <p>WS.asmx:</p>
  
  <pre><code>&lt;%@ WebService Language="C#" CodeBehind="SiteWS.asmx.cs" Class="SiteWS" %&gt;
  </code></pre>
  
  <p>WS.asmx.cs</p>
  
  <pre><code>public class SiteWS : System.Web.Services.WebService
  {
      public static string WSVersion = "1.0";
  }
  </code></pre>
  
  <hr>
  
  <p>New WS.asmx:</p>
  
  <pre><code>&lt;%@ WebService Language="C#" CodeBehind="SiteWS.asmx.cs" Class="SiteWS2" %&gt;    
  public class SiteWS2 : SiteWS
  {
      static SiteWS2()
      {
          SiteWS.WSVersion = "1.0";
      }
  }
  </code></pre>
  
  <p>New WS.asmx.cs</p>
  
  <pre><code>public class SiteWS : System.Web.Services.WebService
  {
      public static string WSVersion = null;
  }
  </code></pre>