Answered Windows 8 App - Proxy detection issue

  • Monday, August 27, 2012 4:59 AM
     
     

    Hi All

    I have a Windows 8 Application running behind the proxy and it throwing the exception "Proxy authentication required (407)."

    Tried the solutions specified in the following thread, with no use

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/64a8d24e-9b99-4cae-9e6c-ea1db05ef3a1

    I am trying to read some RSS feed and display to the UI using the following Code snippet

    SyndicationClient client=new SyndicationClient();
    SyndicationFeed feed=await client.RetrieveFeedAsync(feedUri);

    This Code passes and displays the information sometimes; but most of the times it failed with the Proxy exception.

    How can I ask the user for authentication?

    When we Open the built-in News App or Finance App, it is asking the User to enter Proxy details and connecting to internet. How can I achive the same? If the App fails to authenticate the proxy, prompt the user to enter details [like built-in apps] and once the suer enters the details, try to connect to internet using the entered details.

    Thanks in Advance

    Ambily


    Assistant Consultant

All Replies

  • Monday, August 27, 2012 5:55 PM
     
     Answered Has Code

    You can use CredentialPicker then get ID and password by CredentialPickerResult

    Once you get it, use CredentialCache to create an ICredential

    CredentialCache myCache = new CredentialCache();
    
    myCache.Add(new Uri("http://my-proxy:my-port"),"Basic",new NetworkCredential(ID,Password));
    

    then assign to the handler credential:

    handler.Proxy.Credentials = myCache;

    If you have any further question, feel free to contact me


    • Edited by Emi Smith Monday, August 27, 2012 5:56 PM
    • Marked As Answer by Ambily Tuesday, August 28, 2012 4:43 AM
    •  
  • Tuesday, August 28, 2012 4:46 AM
     
     Answered

    Thanks Emi Smith.

    Proxy detection issue is resolved by enabling the "Internet (Client & Server)" capability. Earlier Internet (Client) was enabled.

    Prompting the user for proxy credentials will be done using your suggestion.

    Thanks

    Ambily


    Assistant Consultant

    • Marked As Answer by Ambily Tuesday, August 28, 2012 4:46 AM
    •  
  • Sunday, September 02, 2012 5:45 AM
     
     
    Where is this 'Capabilities' window found ?
  • Sunday, September 02, 2012 6:35 AM
     
     
    You should double click on the file 'Package.appxmanifest' [for your main project] in the Solution Pane. Then click on 2nd tab.