日期:2014-05-18  浏览次数:20391 次

在aspx.cs文件里,竟然可以这么用弹出框System.Windows.Forms.MessageBox.Show("sss");
在aspx文件里,System.Windows.Forms.MessageBox.Show("sss");可以这么用弹出框吗?

刚才试了试,竟然可以。

以前都是往前台注册一个js代码,例如response.write("<script>alert('sss');</script>");

今天突然发现用System.Windows.Forms.MessageBox.Show("sss");这个也可以。

有啥弊端吗?

------解决方案--------------------
really?
------解决方案--------------------
牛X
------解决方案--------------------
刚才用了一下,居然可以.呵呵,张见识了
------解决方案--------------------
那是因为你装了framework.
------解决方案--------------------
这个应该是在服务器端吧?
------解决方案--------------------
”命名空间“System”中不存在类型或命名空间名称“Windows”(是缺少程序集引用吗?)”

我试怎么不行呀????
------解决方案--------------------
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.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:[code=C#][/code]

this is what i got
------解决方案--------------------
在应用程序未以 UserInteractive 模式运行的情况下显示有模式对话框或窗体是无效的操作。请指定 ServiceNotification 或 DefaultDesktopOnly 样式,以显示服务应用程序发出的通知。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.InvalidOperationException: 在应用程序未以 UserInteractive 模式运行的情况下显示有模式对话框或窗体是无效的操作。请指定 ServiceNotification 或 DefaultDesktopOnly 样式,以显示服务应用程序发出的通知。
------解决方案--------------------
到一个没安.net framework 的client 打开试试。
就或几个人同试登录,让弹出窗口返回一个变量试试。
------解决方案--------------------
到一个没安.net framework 的client 打开试试。 
就或几个人同试登录,让弹出窗口返回一个变量试试。 
---------------------------------------------
B/S结构实在服务器端执行得,你Client端没装有没关系,其实在做自定义控件时引用windows.From然后让他有弹出框的应用很多得,要挂ASP.Net做得东西Serverd端肯定要装framework

------解决方案--------------------
客户端与服务器端的问题,放在客户端访问就能看出区别