How to Solve “System.UnauthorizedAccessException was unhandled”

Problem

When running sample code of VB.net, you may encounter an error message “System.UnauthorizedAccessException was unhandled”

Applies To

  • Windows 7 and above; 32 bit and 64 bit
  • MOBITEK SMS API version 7 and above
  • MOBITEK STK API version 6 and above

Solution

Replace

<requestedExecutionLevel level="asInvoker" uiAccess="false"/>

with

<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

Follow these steps:-

For Visual Studio 2015, goto "View Windows Settings"

For Visual Studio 2015, goto “View Windows Settings”

For Visual Studio 2008, goto "View UAC Settings"

For Visual Studio 2008, goto “View UAC Settings”

Replace <requestedExecutionLevel>

Replace level= “asInvoker” uiAccess= “false” with level= “requireAdministrator” uiAccess= “false”