Click here to Skip to main content
12,953,230 members (85,678 online)
Rate this:
 
Please Sign up or sign in to vote.
could anyone help me. I am building web application using vb .net 2008.

when I debug using the common complier it can show the Message box, but when I use IIS server the message box can't be shown and cause error page.

the error page say:"

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

is there any setting need to be done to solve this case?



Thanks,
Posted 10-Apr-13 20:09pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hello Archit,

You should not be using MessageBox in a web application. It won't show up. The error message explains it prtty clearly. So remove the MessageBox.

Regards,
  Permalink  
v2
Comments
Archit Patel 11-Apr-13 2:13am
   
ok i got it

but if messagebox not work in web app. than why compiler support it ?
Prasad Khandekar 11-Apr-13 2:55am
   
I guess it will be unwise to build such functionality in a language compiler. A .cs or .vb file does not carry information about it's usage.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

You can use javascript message boxes in IIS. Refer the code below:

Dim sb As New System.Text.StringBuilder()
            sb.Append("<script type = 'text/javascript'>")
            sb.Append("window.onload=function(){")
            sb.Append("alert('")
            sb.Append(ex.Message)
            sb.Append("')};")
            sb.Append("</script>")
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", sb.ToString())
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100