locked
CommandInvokedHandler access denied problem

    Question

  • For my windows 8 application, I have a message dialog if the connection times out (there's a function that will reload the page three times to check if a connection can be established, if it fails three times, a message dialog will pop up). However, I'm getting an access denied error when I call the function that will reload the page when the user clicked on a button named "Try again".

    This is my code:

    function TimeOut() {
            var msg = new Windows.UI.Popups.MessageDialog(
                "Time out test");
    
            msg.commands.append(new Windows.UI.Popups.UICommand(
                "Try again",
                commandInvokedHandler));
            msg.commands.append(
                new Windows.UI.Popups.UICommand("Close", commandInvokedHandler));
    
            msg.defaultCommandIndex = 0;
            msg.cancelCommandIndex = 1;
    
            msg.showAsync();
        }
    
    function commandInvokedHandler(command) {
            console.log(command);
            if (command.label == "Try again") {
                reload_page(pPage);
            }
        }

    However, this works:

    function commandInvokedHandler(command) {
            console.log(command);
            if (command.label == "Try again") {
                console.log("Debugging");
            }
        }

    The exact error is:

    0x80070005 - JavaScript runtime error: Access is denied

    If there is a handler for this exception, the program may be safely continued.

    The script highlights the following line of code:

    msg.showAsync();
    Thursday, July 25, 2013 10:32 AM

Answers