locked
Exception Message: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. RRS feed

  • Question

  • User-885259083 posted

    Hi All,

    i am getting the below exception in IIS 8 windows server 2012, but same code is working in IIS 7.5 windows server 2008.

    Exception Message: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.\r\n
    Exception in standardHeader.ascx btnSearch_click

    i am using the below code to show the confirmation message box by using JAVA script.

    Dim javaScript As StringBuilder = New StringBuilder()
    Dim scriptKey As String = "ConfirmationScript"
    javaScript.Append("var userConfirmation = window.confirm('" & message & "');")
    javaScript.Append("if ( userConfirmation == true )")
    javaScript.Append("__doPostBack('UserConfirmationPostBack', userConfirmation);")
    Page.ClientScript.RegisterStartupScript(Me.GetType(), scriptKey, javaScript.ToString(), True)

    calling the above code in button_click and based on the user confirmation i am coming back to the button_click by using postback.

    Thursday, June 27, 2019 11:18 AM

All replies

  • User753101303 posted

    Hi,

    This code is correct (ie you are showing a dialog on the client side).

    More likely you forgot somewhere a MessageBox.Show call that doesn't work on a real web server (it is server side code and so tries to show a message directly on the web server rather than on the client side).

    Edit: or MsgBox in VB.NET

    Thursday, June 27, 2019 2:49 PM
  • User839733648 posted

    Hi Ram_,

    Exception Message: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.\r\n
    Exception in standardHeader.ascx btnSearch_click

    This error happens because you've tried to show dialog box on server from ASP.NET application.

    IIS 7.5 windows server 2008 is the old version and it does not have the function of detecting this behaviour, but the IIS 8 windows server 2012 has added this.

    You should know that user use the browser and they're not able to see the message raised on server.

    For more, you could refer to this helpful link: https://stackoverflow.com/questions/8928713/how-to-resolve-error-showing-a-modal-dialog-box-or-form-when-the-application-i

    Best Regards,

    Jenifer

    Friday, June 28, 2019 9:30 AM
  • User-885259083 posted

    Thanks Patric,

    now it is working

    Friday, June 28, 2019 2:29 PM
  • User-857013053 posted

    Try like this:

    function getConfirmation() {
                   var retVal = confirm("Do you want to continue ?");
                   if( retVal == true ) {
                      document.write ("User wants to continue!");
                      return true;
                   } else {
                      document.write ("User does not want to continue!");
                      return false;
                   }
                }
    Thursday, July 4, 2019 7:29 AM