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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With