On April 1, 2021, we are moving all of our QuotaGuard Support Documentation to 


https://quotaguard.github.io/qg-docs/


 Please Update Your Support Bookmarks


 Documentation for this article will be maintained at 


https://quotaguard.github.io/qg-docs/quickstart-dotnet.html 


Please click on the above link to ensure you are reading 

the most recent and updated documentation.


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 or cloudControl 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 Static:

using System;
using System.IO;
using System.Net;
using System.Text;

namespace QuotaGuardStaticSample {
class MainClass {
public static void Main (string[] args) {
//Extract proxy connection details
string proxyUrl = Environment.GetEnvironmentVariable("QUOTAGUARDSTATIC_URL");
System.Uri proxyUri = new System.Uri(proxyUrl);
string cleanProxyURL = proxyUri.Scheme + "://" + proxyUri.Host+":"+proxyUri.Port;
string user = proxyUri.UserInfo.Split(':')[0];
string password = proxyUri.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();
}
}
}

If you have questions, or if this solution doesn’t work or fit your use case, please reach out to us at Support so we can help figure it out with you.


Working with sensitive data, like HIPAA, Financial, or Personally Identifiable Information (PII)? 
    Then you will want to check out our QuotaGuard Shield solution, it's the same as QuotaGuard Static, but with stronger end to end security for your requests. We can also help migrate current Static customers to Shield for free, just reach out to us at Support to request assistance.