c# HttpWebRequest not sending default credentials to proxy server

孤街浪徒 提交于 2019-12-12 09:43:23

问题


I am using squid proxy server to authenticate the client before passing on the request to public network. I haven't set HttpWebRequest.Proxy object so I am assuming that the web request will take the default window credentials and pass on to the proxy server.

I have added an entry of the user to squid proxy as well, but I am getting the following error while making the request.:

(407) Proxy Authentication Required.

In squid logs, I am getting this:

TCP_DENIED/407 3722 CONNECT 

I have inserted the following block in App.config

<system.net>
    <defaultProxy useDefaultCredentials="true">
        <proxy
        usesystemdefault="true"/>
    </defaultProxy>
</system.net> 

To verify if there is discrepancy between the user credentials registered with squid and my windows user credentials. I tried opening a public website through browser which prompted for credentials as the request was passing through proxy server ( which I have set under Internet Options ), after entering windows credentials I was able to access that site.

Also, i checked through Fiddler ( a tool to check network traffic ) that the request to that proxy server didn't have Proxy-Authorization Header.

Can anybody please check and tell if something I have missed or I have made any mistake.

来源:https://stackoverflow.com/questions/38734738/c-sharp-httpwebrequest-not-sending-default-credentials-to-proxy-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!