Error: 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.
This error is occure due to message box.
Loading

Niradhip ChakrabortyPosted Aug 10, 2009, 8:58 AM
There is no direct solution, the use of a messagebox which is raised in server-side code is illogical in a client-server situation such as a browser based application. There are basically two options that you can consider:
1) Modify your approach to allow you to use client-side script to display alerts using window.alert() for example before posting back to the server once everything is sorted
2) Modify your approach to end the processing server-side, emit relevant client-side script and html to display the alert on the client, then handle the continuation of processing on the server side.
Personally I would go with option 1 as it is generally the easiest (though not always easy).
OF course there is a third option which is to use a different mechanism for recording alerts generated in this way (or just don't do it!).
If you want to display a message I would use...
Response.Write("")
Kirtan PatelPosted Aug 10, 2009, 7:48 AM
Sanjay ChauhanPosted Aug 10, 2009, 7:12 AM
U can specify servicenotification or DefaultDesktopOnly option in message box enumeration .
Specify like that
MessageBoxOptions.ServiceNotification
MessageBoxOptions.DefaultDesktopOnly