2014-10-01 2 views
0

Windows 인증이 필요한 웹 사이트에서 이미지를 표시하려고합니다. 나는 현재이 사용하고 있습니다 :WPF XAML 이미지 소스 및 필수 Windows 인증

<Image Grid.Column="0" Source="https://Foo/899fddb8-d5df-4f04-9d20-50de22f7d671/0102d4d6-3c3d-4717-985b-74021348413d.png" Margin="5,0,0,0" /> 

그것은 브라우저에서 작동하며이 코드가 작동 : 내의 App.config에서

내가 넣어 :

<Image Grid.Column="0" Source="http://img.clubic.com/00C8009607654557-c1-photo-bbpppremium.jpg" Margin="5,0,0,0" /> 

답변

1

내가 해결책을 발견
<system.net> 
    <defaultProxy enabled="true" useDefaultCredentials="true" /> 
    </system.net> 

내 응용 프로그램 클래스 :

public partial class App : Application 
{ 
    public App() 
    { 
     Current.Startup += CurrentOnStartup; 
    } 

    private void CurrentOnStartup(object sender, StartupEventArgs startupEventArgs) 
    { 
     WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials; 

     AuthenticationManager.CredentialPolicy = new ProxyCredentials(); 
    } 
} 

internal class ProxyCredentials : ICredentialPolicy 
{ 
    bool ICredentialPolicy.ShouldSendCredential(Uri challengeUri, WebRequest request, NetworkCredential credential, 
     IAuthenticationModule authenticationModule) 

    { 
     return true; 
    } 
} 

출처 : http://social.msdn.microsoft.com/Forums/vstudio/en-US/e5a064eb-578b-4334-95f6-e40d5a0e2cc2/proxy-authentication-problems-with-remote-resources-error-407?forum=wpf