I created a small web service that creates a HttpWebRequest
to another website using a proxy
and after i used the proxies i got that error:
It seems that you are running into a trust related issue. You might be able to work-around the issue by including in your Web.Config
, under System.Web
,
<trust level="Full" />
WebPermission
is not available under a medium trust
environment (and you can look at this article to modify this behavior and for the reasons why you shouldn't).
However, if you require full trust
you might have to reconsider the requirements of your application.
go to properties of your Project/application (WPF)
In security select enable clickone securitysetting. and set trust level of the project
I was also having this issue - and it turned out to be due to dll performing the web request having being downloaded from the web.
I had to go into the Properties of the dll in file explorer (right click> Properties) and click "Unblock" - making sure to click "Apply" and then "Ok".