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 some poorly formatted data and need to pull numbers out
I have been given some matlab code compiled using the .net compiler. I can
I have been given control of a web site in Classic ASP. What is
I am very new to Spring and I have been given some basic instructions
I have been given some generated code which looks like so: <form id=form1 method=post
I have been given the task of re-writing some libraries written in C# so
I have been given the below .NET question in an interview. I don’t know
We have been given a site xyz.com, in which the home page has images
I have been given the tasks of speccing a mobile application, which will need
I am new to open gl, and have been trying to do some basic

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.