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


 Please Update Your Support Bookmarks

 Documentation for this article will be maintained at 


Please click on the above link to ensure you are reading 

the most recent and updated documentation.

This example assumes your QUOTAGUARD_URL environment variable is set and contains your unique connection string. 


Here we show how to use QuotaGuard to access a SOAP service from a .NET MVC web controller. This example should also apply to other WebRequests made from an MVC controller. 


A common use case is from your MVC controller you want to access an IP-whitelisted service that uses SOAP but the web service object does not have a "proxy" property that allows you to specify the QuotaGuard proxy service.


Solution: Create a proxy object and use it as a property of the WebRequest MVC class, which will send all following requests via the proxy. 


The solution is split in to two parts, the configuration in your web.config (which on Azure can be done from your management console) and the MVC Controller itself. 


MVC Controller


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bank.Webservices; // fictitious namespace name for your webservice's reference
using System.Diagnostics;
using System.Xml;
using System.Net;
using System.Web.Configuration;

public class PaymentController : Controller
// this is usually a form result, so attribute of action is HttpPost
public ActionResult Index(string anyTokenYouUseWithYourBank)
string QuotaGuardProxyAddress = WebConfigurationManager.AppSettings["QuotaGuard_Proxy_URI"];
// to get the Proxy Uri from Web.config

string QuotaGuardUser = WebConfigurationManager.AppSettings["QuotaGuard_User"];
// to get the Proxy User from Web.config

string QuotaGuardPassword = WebConfigurationManager.AppSettings["QuotaGuard_Password"];
// to get the Proxy Password from Web.config

var proxy = new WebProxy(QuotaGuardProxyAddress);
// we create a new proxy object

proxy.Credentials = new NetworkCredential(QuotaGuardUser, QuotaGuardPassword);
// we give the proxy the QuotaGuard credentials

WebRequest.DefaultWebProxy = proxy;
// thanks to WebRequest, from here on every request of this controller will pass through the proxy

var soapClientObject = new WSBankSoapClient(); //fictitious name for the banks's web service

var result = soapClientObject .GrabSomethingOnTheNet(anyTokenYouUseWithYourBank);
// now our WS call goes passes Proxy and in the variable result we have the web service's result

// we use the result here 

return Redirect("http://newpage");



Configuration (web.config)

The section to add the keys to is <configuration><appSettings> (which you can also directly modify in the Azure Console):


<!-- keys for QuotaGuard-->
<add key="QuotaGuard_Proxy_URI" value="http://yourQuotaGuardUser:yourQuotaGuardPassword@eu-west-1-babbage.getstatica.io:9293"/>
<add key="Statica_User" value="yourQuotaGuardUser"/>
<add key="Statica_Password" value="yourQuotaGuardPassword"/>
<!-- end of keys for QuotaGuard-->

This solution was kindly contributed by Riccardo Moschetti, a Microsoft MCSD Web Applications specialist.

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.