title: Why do I get an error when using HttpContext?
body: <p>I'm working on a code to make a website with songs, but i'm getting an error when using this code:</p>
  <pre><code>ds.ReadXml(HttpContext.Current.Server.MapPath(filepath));
  </code></pre>
  <p>the error code is: <strong>CS0103: The name 'HttpContext' does not exist in the current context</strong></p>
  <p>My SongMethods.cs code is:</p>
  <pre><code>using System.Data;
  using System;
  /// &lt;summary&gt;
  /// Summary description for Class1
  /// &lt;/summary&gt;
  public class Pokoes
  {
  public Pokoes()
  {
      //
      // TODO: Add constructor logic here
      //
  }
  public DataSet GetAllSongs(string filepath)
  {
      DataSet ds =new DataSet(&quot;playlist&quot;);
  
      DataTable dtSongs =new DataTable(&quot;song&quot;);
  
      DataColumn dcId = new DataColumn(&quot;id&quot;);
      DataColumn dcTitle = new DataColumn(&quot;title&quot;);
      DataColumn dcArtist = new DataColumn(&quot;artist&quot;);
      DataColumn dcYear = new DataColumn(&quot;year&quot;);
      DataColumn dcGenre = new DataColumn(&quot;genre&quot;);
      DataColumn dcFile = new DataColumn(&quot;file&quot;);
  
      dtSongs.Columns.Add(dcId);
      dtSongs.Columns.Add(dcTitle);
      dtSongs.Columns.Add(dcArtist);
      dtSongs.Columns.Add(dcYear);
      dtSongs.Columns.Add(dcGenre);
      dtSongs.Columns.Add(dcFile);
      ds.Tables.Add(dtSongs);
  
      ds.ReadXml(HttpContext.Current.Server.MapPath(filepath));
  
      return ds;
  }
  
  }
  </code></pre>
  <p>My index code is:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  
  @using System;
  @using XmlCrud.App_Code;
  
  @{
  SongMethods mySongMethods = new SongMethods();
  string filePath = Server.MapPath(@&quot;~\App_Data\playlist.xml&quot;);
  DataSet ds = mySongMethods.GetAllSongs(filePath);
  }
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;XmlCrud&lt;/title&gt;
  &lt;link href=&quot;~/Content/bootstrap.min.css&quot; rel&quot;stylesheet&quot; /&gt;
  &lt;script src=&quot;~/Scripts/bootstrap.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;br /&gt;&lt;br /&gt;
        &lt;table class=&quot;table-bordered&quot;&gt;
            &lt;tr&gt;
              &lt;th&gt;Id&lt;/th&gt;
              &lt;th&gt;Title&lt;/th&gt;
              &lt;th&gt;Artist&lt;/th&gt;
              &lt;th&gt;Year&lt;/th&gt;
              &lt;th&gt;Genre&lt;/th&gt;
              &lt;th&gt;File&lt;/th&gt;
             &lt;/tr&gt;
  
            @foreach (DataRow dr in ds.Tables[&quot;song&quot;].Rows)
            {
                &lt;tr&gt;
                    &lt;td&gt;@dr[&quot;id&quot;]&lt;/td&gt;
                    &lt;td&gt;@dr[&quot;title&quot;]&lt;/td&gt;
                    &lt;td&gt;@dr[&quot;artist&quot;]&lt;/td&gt;
                    &lt;td&gt;@dr[&quot;year&quot;]&lt;/td&gt;
                    &lt;td&gt;@dr[&quot;genre&quot;]&lt;/td&gt;
                    &lt;td&gt;@dr[&quot;file&quot;]&lt;/td&gt;
                &lt;/tr&gt;
            }
        &lt;/table&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  <p>My playlist.xml is:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;playlist&gt;
   &lt;song&gt;
  &lt;id&gt;1&lt;/id&gt;
  &lt;title&gt;if i can't&lt;/title&gt;
  &lt;artist&gt;50 cents&lt;/artist&gt;
  &lt;year&gt;2005&lt;/year&gt;
  &lt;genre&gt;rap&lt;/genre&gt;
  &lt;file&gt;link&lt;/file&gt;
  &lt;/song&gt;
  &lt;song&gt;
  &lt;id&gt;2&lt;/id&gt;
  &lt;title&gt;time in a bottle&lt;/title&gt;
  &lt;artist&gt;jimmy croche&lt;/artist&gt;
  &lt;year&gt;1973&lt;/year&gt;
  &lt;genre&gt;accoustic&lt;/genre&gt;
  &lt;file&gt;link&lt;/file&gt;
  &lt;/song&gt;
  &lt;/playlist&gt;
  </code></pre>
  <p>we have asked one of our teachers but he couldn't help us with the problem at the moment, so we hope some people in here can.</p>