Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Proxy behaviour in WPF application

$
0
0

Hi,

I have a WPF application that communicates with a WCF service. Recently it was desired for this application to communicate over a proxy. This was implemented as following:

var proxy = new WebProxy(proxyAddress, false);
proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword);
WebRequest.DefaultWebProxy = proxy;

This works nice, yet I have an issue because of the way how the credentials are stored. I found out that these credentials are stored for longer time (they are stored even after computer restart) and this does not suit me, because I need to be able to force the client to input his proxy credentials each time he starts the application. For example, he starts the application, does something and then finishes and if he starts the application again, the proxy credentials would need to be set again.

My question is: how can I reset the proxy credentials of DefaultWebProxyprogramatically and can the proxy be set only for the current application (but in some central way that works with WCF service references).

Thanks in advance!

Btw, I haven't also found a way how to clear this proxy credentials cache manually in windows. This clearing of the cache seems to me like random behaviour...


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>