.NET Quick Start Guide - QuotaGuard Static IP

    Table of contents

    Installation

    When you sign up you will be provided with a unique username and password and a connection string that you can use when configuring your proxy service in your application:

    http://username:password@static.quotaguard.com:9293
    

    All requests that you make via this proxy will appear to the destination server to originate from one of the two static IPs you will be assigned when you sign up.

    We recommend you store the connection string in an environment variable QUOTAGUARDSTATIC_URL. If you have signed up via the add-ons platform on Heroku this variable will be automatically set in your production environment.

    Integration

    This example is written in C# and uses the HttpWebRequest class to make a request via QuotaGuard.

    //Extract proxy connection details
    string proxyUrl = Environment.GetEnvironmentVariable("QUOTAGUARDSTATIC_URL");
    System.Uri proxyUri = new System.Uri(url);
    string cleanProxyURL = uri.Scheme + "://" + uri.Host+":"+uri.Port;
    string user = uri.UserInfo.Split(':')[0]
    string password = uri.UserInfo.Split(':')[1]
    HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://ip.jsontest.com/");
    WebProxy myProxy = new WebProxy();
    Uri newUri = new Uri(cleanProxyURL);
    // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
    myProxy.Address = newUri;
    // Create a NetworkCredential object and associate it with the 
    // Proxy property of request object.
    myProxy.Credentials = new NetworkCredential(user, password);
    request.Proxy = myProxy;
    
    HttpWebResponse httpWebResponse = request.GetResponse() as HttpWebResponse;
    // Get the stream containing content returned by the server.
    Stream dataStream = httpWebResponse.GetResponseStream();
    
    // Open the stream using a StreamReader for easy access.
    StreamReader streamReader = new StreamReader(dataStream);
    
    // Read the content.
    String responseFromServer = streamReader.ReadToEnd();
    
    // Write the content.
    Console.WriteLine(responseFromServer);
    
    streamReader.Close();
    dataStream.Close();
    

    We have examples for other common libraries as well, but if you can’t find what you are looking for just send us a Support ticket and we’ll get one sent to you.


    Ready to Get Started?

    Get in touch or create a free trial account