|
|
|
|
|
|
|
|
|
|
| |
Steven,
Thanks for the post. I did use reflector but didn't bother looking at the
implementation of UseDefaultCredentials. Once i set it to the
DefaultCredentials everything worked fine.
The only thing that bothers me is that i'm relying on that implementation
but i guess it makes sense that setting the ICredential property to the
DefaultCredentials would force it to this. Even if it didn't it will still
use the default creds anyway. Thanks again!
Thanks again,
Cisco
"Steven Cheng[MSFT]" wrote:
> Hello cisco man,
>
> As for the WebRequest.GetSystemWebPRoxy it does return a
> "System.Net.WebRequest+WebProxyWrapperOpaque" type which is internal.
> Actually, when using the returned object from WebRequest.GetSystemWebProxy
> method, you're always suggested to use the "IWebProxy" interface as that
> interface has provide all the necessary properties.
>
> For the "useDefaultCredentials" property of WebProxy class, it simply
> assign the corresponding credentials to the IWebProxy.Credentials
> property(according to the given value). Here is the diassembed code from
> reflector:
>
> =====from WebProxy class======
> public bool UseDefaultCredentials
> {
> get
> {
> if (!(this.Credentials is SystemNetworkCredential))
> {
> return false;
> }
> return true;
> }
> set
> {
> this._Credentials = value ? CredentialCache.DefaultCredentials
> : null;
> }
> }
>
> public ICredentials Credentials
> {
> get
> {
> return this._Credentials;
> }
> set
> {
> this._Credentials = value;
> }
> }
>
>
> ================
>
> therefore, the setting "UseDefaultCredentials" of WebProxy to true is
> identical to the following code (for IWebProxy):
>
> =======================
> IWebProxy proxy = WebRequest.GetSystemWebProxy();
>
> proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
> =======================
>
> Hope this helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
>
> ==================================================
>
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights |
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|