title: How to utilize a REST API in ASP.Net 3.5?
body: <p>I have been given some basic documentation of the RazorGator REST API and need to incorporate it into an ASP.NET 3.5 site.  I've created my class file to call the API which contains my WebRequest.Create ("URL TO API").  How do I then make the output available so that it can be consumed by other pages?  That is, the tickets.aspx page needs to obtain the output results of this API call.  What constructs should I use to make this available in tickets.aspx?</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edit</strong>
  Here's the code I've written thus far:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.IO;
  using System.Net;
  using System.Text;
  
  namespace SeatEater.Web.UI.search
  {
  public class RazorGatorService
  {
  
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.razorgator.com/ticketservice/ticets.xml?blahblah") as HttpWebRequest ;
      HttpWebResponse response = (HttpWebResponse)request.GetResponse();
      Stream receiveStream = response.GetResponseStream();
      StreamReader readStream = new StreamReader(receiveStream, encode);
      response.close();
      readStream.close();
  
  }
  
  }
  </code></pre>
  
  <p>I receive the error message:</p>
  
  <pre><code>A field initializer cannot reference the nonstatic field, method, or property 'field'
  </code></pre>
  
  <p>in the second line of the above codeblock.  I'm very new to using HttpWebRequest and HttpWebResponse.  Can you advise me as to how to rectify the error message I'm receiving?</p>
  
  <p>Thanks!</p>