title: An object reference is required for the non-static field, method, or property 'HttpContext.Request'
body: <p>I don't know how to solve the following problem:</p>
  <p><code>An object reference is required for the non-static field, method, or property 'HttpContext.Request'</code></p>
  <p>I am using the new Visual Studio 2015 with ASP.NET 5 MVC 6. In that Version the HttpContext.Request is an abstract method and i dont't know how to use it.</p>
  <pre><code>namespace STReportGenerator.Controllers
  {
      public class HomeController : Controller
      {
          public IActionResult Index()
          {
              return View();
          }            
          
          public IActionResult Upload()
          {
              ViewBag.Title = &quot;scaffmax config&quot;;
              if (**HttpContext.Request.InputStream.Length** == 0)
              {
                  ViewData[&quot;error&quot;] = &quot;No configuration data uploaded&quot;;
                  return RedirectToAction(&quot;XMLUpload&quot;, &quot;Home&quot;);
              }
              var inputStream = HttpContext.Request.InputStream;
              if (HttpContext.Request.Files.Count != 0)
              {
                  inputStream = HttpContext.Request.Files[0].InputStream;
              }
  
              DataSet dataSet = new DataSet();
              try
              {
                  dataSet.ReadXml(inputStream);
              }
              catch
              {
                  ViewData[&quot;error&quot;] = &quot;The configuration data is invalid&quot;;
                  return RedirectToAction(&quot;XMLUpload&quot;, &quot;Home&quot;);
              }
  
              inputStream.Position = 0;
              Configuration Config = new Configuration();
              Config.LoadFromXMLStream(inputStream);
  
              string g = Guid.NewGuid().ToString();
  
              string configFileName = HttpContext.Server.MapPath(&quot;~/xml/&quot;) + g + &quot;.xml&quot;;
              dataSet.WriteXml(configFileName);
  
  
              switch (Config.Language)
              {
                  case &quot;de&quot;:
                      {
                          ViewData[&quot;headline&quot;] = &quot;Auswahl Reportvorlage&quot;;
                          ViewData[&quot;imageContent&quot;] = &quot;Firmenlogo:&quot;;
                          ViewData[&quot;projectlist&quot;] = &quot;Wähle eine Vorlage:&quot;;
                          ViewData[&quot;sendButton&quot;] = &quot;Senden&quot;;
                          break;
                      }
                  case &quot;us&quot;:
                      {
                          ViewData[&quot;headline&quot;] = &quot;Report-Template Selection&quot;;
                          ViewData[&quot;imageContent&quot;] = &quot;Company Logo:&quot;;
                          ViewData[&quot;projectlist&quot;] = &quot;Select a template:&quot;;
                          ViewData[&quot;sendButton&quot;] = &quot;Send&quot;;
                          break;
                      }
              }
  
              ReportList rL = new ReportList(HttpContext.Server.MapPath(&quot;~/Reports&quot;));
  
              for (int i = 0; i &lt; rL.reportsList.Count; i++)
              {
                  if (!CheckXmlandXsd(rL.reportsList[i], g))
                  {
                      rL.reportsList.RemoveAt(i);
                      i--;
                  }
              }
              if (rL.reportsList.Count == 0)
              {
                  ViewData[&quot;errorTemplateList&quot;] = &quot;No valid template on the server. Please try an other xml data.&quot;;
              }
              ViewData[&quot;inputXmlName&quot;] = g;
              ViewData[&quot;Logo&quot;] = Config.Logo;
              ViewBag.ShowDesigner = Config.ShowDesigner;
              ViewBag.Template = Config.Template;
       
              return View(rL.reportsList);
          }
  
          public bool CheckXmlandXsd(string xsdname, string xmlname)
          {
              try
              {
                  XmlDocument xmld = new XmlDocument();
                  xmld.Load(HttpContext.Server.MapPath(&quot;~/xml/&quot;) + xmlname + &quot;.xml&quot;);
                  xmld.Schemas.Add(null, HttpContext.Server.MapPath(&quot;~/xsd/&quot;) + xsdname + &quot;.xsd&quot;);
                  xmld.Validate(ValidationCallBack);
                  return true;
              }
              catch
              {
                  return false;
              }
          }
  
          private void ValidationCallBack(object sender, System.Xml.Schema.ValidationEventArgs e)
          {
              throw new NotImplementedException();
          }
  
      }
  }
  </code></pre>