# HTTP Request needs Proxy Authentication

**URL:** <https://forum.uipath.com/t/http-request-needs-proxy-authentication/332911>\
**Category:** Activities\
**Tags:** http-request, web, question, system, webapi, activities\
**Created:** [July 28, 2021, 8:40am UTC](https://forum.uipath.com/t/http-request-needs-proxy-authentication/332911 "2021-07-28T08:40:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![aasif.khan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/aasif.khan/32/176937_2.png) [@aasif.khan](https://forum.uipath.com/u/aasif.khan)\
**Post date:** [August 4, 2021, 9:56am UTC](https://forum.uipath.com/t/http-request-needs-proxy-authentication/332911/2 "2021-08-04T09:56:55Z")

</div>

An update, I’ve managed to used the Incoke Code activity to use VBNet code, to call one of our APIs (a GET request). Below is the code:

**Dim fr As System.Net.HttpWebRequest**  
**Dim targetURI As New Uri(strURL)**

**fr = DirectCast(HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)**

**Dim webProxy As IWebProxy = New WebProxy(strIpAddressAndPort)**  
**webProxy.Credentials = New NetworkCredential(strProxyUsername, strProxyPassword)**  
**fr.Proxy = webProxy**  
**fr.Credentials = New NetworkCredential(strSimpleAuthUsername, strSimpleAuthPassword)**

**Dim username As String = strSimpleAuthUsername**  
**Dim password As String = strSimpleAuthPassword**  
**Dim encoded As String = System.Convert.ToBase64String(Encoding.GetEncoding(“ISO-8859-1”).GetBytes(username + “:” + password))**  
**fr.Headers.Add(“Authorization”, "Basic " + encoded)**

**Dim res As HttpWebResponse = DirectCast(fr.GetResponse(), System.Net.HttpWebResponse)**  
**webRes = res**

**Dim html As String = New StreamReader(res.GetResponseStream()).ReadToEnd()**  
**strHtml = html**

* * *

Some notes:

strProxyIpAddressAndPort is in the form: IpAddress:PortNumber e.g. 192.168.1.1:8080  
strURL is the API endpoint  
strURL, strIPAddressAndPort, strProxyUsername, strProxyPassword, strSimpleAuthUsername, strSimpleAuthPassword are In Arguments  
webRes and strHtml are Out Arguments

* * *

I tried to use similar code (but adding additional headers and code) in another API call for a PUT request, but that’s giving me the 403 error (Forbidden). We ended up not having to use this Environment for our application since it’s only in this environment where proxy authentication is needed.

Hopefully this helps someone that is having a similar issue. Cheers!

---

_[View the full topic](https://forum.uipath.com/t/http-request-needs-proxy-authentication/332911)._
