locked
WebAuthenticationOptions.UseCorporateNetwork throws ArgumentException

    Question

  • I've added the PrivateNetwork, EnterpriseAuthentication and SharedCertificates capabilities to my Windows 8.1 app package but my app throws an ArgumentException ("Value does not fall within the expected range.") at runtime if I specify this option. If I set the option to None I can successfully login over the internet but the login fails when run inside the corporate network.


    Peter Foot | Microsoft Windows Phone Development MVP


    Monday, April 14, 2014 3:57 PM

All replies

  • What is the exact exception?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, April 14, 2014 8:05 PM
    Moderator
  • ArgumentException

    Message: "Value does not fall within the expected range."

    HResult: -2147024809

    Source: Windows.Security

    StackTrace:

    at Windows.Security.Authentication.Web.WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions options, Uri requestUri, Uri callbackUri)
       at Reader.ViewModels.LoginViewModel.<Login>d__4.MoveNext()


    Peter Foot | Microsoft Windows Phone Development MVP

    Monday, April 14, 2014 9:30 PM
  • Did you get any solution to your issue?
    Wednesday, May 14, 2014 6:03 AM
  • Nope, still no resolution

    Peter Foot | Microsoft Windows Phone Development MVP

    Wednesday, May 14, 2014 12:44 PM
  • I am not able to reproduce this.  Are you able to upload a sample to OneDrive?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, May 15, 2014 7:09 PM
    Moderator
  • Are you sure you set the required capabilities for the WebAuthenticationOptions.UseCorporateNetwork option:

    - privateNetworkClientServer

    - enterpriseAuthentication

    - sharedUserCertificate 

    MSDN says: "WebAuthenticationOptions.UseCorporateNetwork tells the web authentication broker to render the webpage in an app container that supports privateNetworkClientServer, enterpriseAuthentication, and sharedUserCertificate capabilities. Note the application that uses this flag must have these capabilities as well."

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Tuesday, September 9, 2014 2:29 PM
  • I am experiencing the same problem.

    I have set the privateNetworkClientServer, enterpriseAuthentication and sharedUserCertificate capabilities for my app.

    The exception is not helpful as it does not specify which argument has a value that does not fall within the expected range. And the exception does not specify what the expected range is.

    It's not clear to me how I can determine how to make this work given the information available.

    Tuesday, December 9, 2014 6:17 PM
  • Can you upload a sample to OneDrive and share it here? I'll try to reproduce it.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 16, 2014 1:27 PM
    Moderator
  • Hi, i'm experiencing the same issue but as i saw it throws the ArgumentException just when i set the callback url.

    Without a callback it works fine but the WebAuthBroker never gives back the control to the app.

    I've uploaded a sample project to my OneDrive: http://1drv.ms/1BX4Uh9

    Thanks for the help in advance!

    Thursday, February 5, 2015 1:00 PM
  • Pardon my ignorance, but what's the purpose in adding "UseCorporateNetwork" in this context?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, February 5, 2015 4:16 PM
    Moderator