Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve Error : Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation

Tags:

I am working on project. In my System when I run the project it is running nicely, but after uploading it to my domain when I check, then it displays the error like:

"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."

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: 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.

What is is the reason for this and how can I resolve it?

Please help me...

Thanks.

like image 580
Darsak Avatar asked Jan 19 '12 15:01

Darsak


2 Answers

This error can be resolved by adding MessageBoxOptions.ServiceNotification.

MessageBox.Show(msg, "Print Error", System.Windows.Forms.MessageBoxButtons.YesNo,     System.Windows.Forms.MessageBoxIcon.Error,         System.Windows.Forms.MessageBoxDefaultButton.Button1,     System.Windows.Forms.MessageBoxOptions.ServiceNotification);  

But it is not going to show any dialog box if your web application is installed on IIS or server.Because in IIS or server it is hosted on worker process which dont have any desktop.

like image 94
Anukana Saha Avatar answered Sep 24 '22 15:09

Anukana Saha


You 100% can do this on the server side...

     Protected Sub Button3_Click(sender As Object, e As System.EventArgs)     MesgBox("Test") End Sub  Private Sub MesgBox(ByVal sMessage As String)     Dim msg As String     msg = "<script language='javascript'>"     msg += "alert('" & sMessage & "');"     msg += "</script>"     Response.Write(msg) End Sub 

here is actually a whole slew of ways to go about this http://www.sislands.com/coin70/week1/dialogbox.htm

like image 39
Nefariis Avatar answered Sep 21 '22 15:09

Nefariis