locked
Using IMbnInterfaceManager.GetInterface to get IMbnInterface, success on Win8,but failed on Win8.1 for "Access is denied".

    Question

  • I wrote a metro App to get the mobile broadband connection status of system. The main code is as follows:

    public void InitializeManagers()
     {
        try
        {
            // Get MbnInterfaceManager
            if (m_MbnInterfaceManager == null)
            {
                m_MbnInterfaceManager = (IMbnInterfaceManager)new MbnInterfaceManager();
            }
     
            if (m_MbnInterface == null)
            {
                m_MbnInterface = GetFirstInterface();
            }
        }
        catch (Exception e)
        {
            rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage);
        }
    }
    
    private IMbnInterface GetFirstInterface()
    {
        foreach (IMbnInterface mbnInterface in m_MbnInterfaceManager.GetInterfaces())
        {
            return mbnInterface;
        }
        return null;
    }

    It goes well on win8 OS, and I can get the connection status successfully. But it failed on win8.1. The exception is:

    Unexpected.exception occured:System.UnauthorizedAccessException:Access is denied.
    
    at Microsoft.MBN.IMbnInterfaceManager.GetInterface()
    
    at MobileBroadbandComApi.MBApiImplementation.GetFirstInterface()

    I don't know if the method to get IMbnInterface is different on two OS. Can anyone help me?

    Best regards!

    Wednesday, December 04, 2013 8:47 AM

Answers

All replies