Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3444152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:52:46+00:00 2026-05-18T08:52:46+00:00

I have been given some basic documentation of the RazorGator REST API and need

  • 0

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?

Thanks!

Edit
Here’s the code I’ve written thus far:

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();

}

}

I receive the error message:

A field initializer cannot reference the nonstatic field, method, or property 'field'

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?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:52:47+00:00Added an answer on May 18, 2026 at 8:52 am

    I would create a simple class, e.g “RazorGatorResult.cs“, that holds onto the different information returned from the API. (or more specifically, only the info you need).

    You can then create a “RazorGatorService” assembly in your application, which the web application has a reference to.

    The “RazorGatorService” would be responsible for calling the API, and hydrating the raw HTTP response (be it HTML, JSON, XML, etc) into a strongly-typed “RazorGatorResult” object, which can be used by the web tier.

    Then any page can simply call through that service:

    using RazorGatorService; 
    
    RazorGatorResult result = RazorGatorService.GetSomeFunkyStuff();
    

    This has 3 benefits:

    1 – You can call the API anywhere from your web application

    2 – The actual implementation (HTTP call, de-serialization) is abstracted away

    3 – You can maintain/fine-tune the code in a seperate assembly, and not affect your web tier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given a requirement where I need to support multiple databases in
I have been given two different Microsoft Word document that my virus scanner has
I have been given a DLL (InfoLookup.dll) that internally allocates structures and returns pointers
I am given a problem where I have been given N nodes in a
Have recently been given a project to complete which uses XML quite extensively.Am looking
I have recently been given a task to add the ability to interact with
Have been looking at the MVC storefront and see that IQueryable is returned from
Have been studying the file system related classes of Adobe AIR 1.5, but so
We have been using CruiseControl for quite a while with NUnit and NAnt. For
I have been experimenting with woopra.com A web analytics tool. Which requires a piece

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.