title: asp.net playing sound file from code behind
body: <p>I have a page that calculates certain values coming from a web service.</p>
  
  <p>I would like to be able to play different sounds based on the calculation results. There must be no interaction from the user (click button to play).</p>
  
  <p>The SoundPlayer class seems like what I need but I believe there is an error with the relative path because if I specify the absolute path it does work.</p>
  
  <pre><code>System.Media.SoundPlayer playthewavfile = new System.Media.SoundPlayer(@"Sounds\sound1.wav");
  playthewavfile.Play();
  </code></pre>
  
  <p>The Sounds folder is in the root of the website.</p>