How to resolve the error: displaying a modal dialog box or form when the application is not working in UserInteractive mode is not a valid operation

I'm working on the project. On my system, when I run the project, it works well, but after uploading it to my domain, when I check, it displays an error, for example:

"Displaying 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 the service application."

Description An unhandled exception occurred during the execution of the current web request. View the stack trace for more information about the error and its occurrence in the code.

Exception Details : System.InvalidOperationException: Displaying a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify a ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

What is the reason for this and how to resolve it?

Please help me...

Thanks.

+8
source share
4 answers

You can do it 100% 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 set of ways to do this http://www.sislands.com/coin70/week1/dialogbox.htm

+10
source share

You cannot display the ON SERVER dialog box from an ASP.NET application, of course, you can do this, but it does not make sense, since your user is using a browser and he cannot see the messages that are raised on the server. You need to understand how websites work, server-side code (ASP.NET in your case) creates html, javascript, etc. On the server, and then the browser downloads this content and displays it to the user, so in order to present a modal message box to the user, you must use Javascript, for example, a warning function.

Here is an example for asp.net:

http://madskristensen.net/post/JavaScript-AlertShow%28e2809dmessagee2809d%29-from-ASPNET-code-behind.aspx

+7
source share

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 will not show any dialog box if your web application is installed on IIS or server. Because in IIS or the server it is hosted on a workflow that does not have a desktop.

+7
source share

For Vb.Net Framework 4.0 U can use:

 Alert("your message here", Boolean) 

The boolean value here can be True or False. True If you want to close the window immediately after, False If you want to leave the window open.

-one
source share

All Articles