显示弹出窗口,让用户在asp.net应用程序(从本地应用程序弹出显示相反从服务器上部署的应用程序弹出) [英] Display popup to user in asp.net application (popup from local application is displayed contrary to popup from server deployed application)

查看:155
本文介绍了显示弹出窗口,让用户在asp.net应用程序(从本地应用程序弹出显示相反从服务器上部署的应用程序弹出)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的深化发展asp.net应用程序。当用户点击一个按钮,他所谓的web服务的传球也是他在一个文本框之前已经进入的参数。当WebService返回结果,它显示一个弹出式,一切正常的地方,但是当我在我的Windows服务器上部署我的应用程序,将不显示弹出。这是我的code:

 如果(!string.IsNullOrEmpty(textbox.text))
        {
            尝试
            {
               // Web服务调用
               字符串结果= webservice.function(textbox.text);
            }
            赶上(前的SoapException)
            {
                Utils.Log_File(ex.Message);
                Utils.Log_File(ex.StackTrace);
                字符串消息= ex.Message;
                //这个弹出不工作的部署的应用程序
                Page.ClientScript.RegisterClientScriptBlock(的GetType(),从背后code错误,的String.Format(警报('{0}'),消息),TRUE);
            }
        }

我从调试客户端我的code镀铬中看到错误。
当调试本地主机一切正常,从的SoapException弹出显示此消息[E_E1] [参数NOTFOUND]​​

在我调试服务器应用程序,我得到的铬控制台这个错误:

 <脚本类型=文/ JavaScript的>
//<![CDATA [
警报(服务器无法处理[E_E1] [参数NOTFOUND]
    [未捕获的SyntaxError意外标记非法]
....


解决方案

尝试使用ClientScript.RegisterStartupScript(this.GetType(),错误,警报('+ + MAILMESSAGE'););

I am developping an asp.net application. When an user clicks on a button, he calls a webservice passing also the parameter he has before entered in a textfield. When the webservice returns no results, it displays a popup, everything works well in local, but when I deploy my application on my windows server, the pop up is not displayed. This is my code:

        if (!string.IsNullOrEmpty(textbox.text))
        {
            try
            {
               //webservice call
               string result = webservice.function(textbox.text);
            }
            catch (SoapException ex)
            {
                Utils.Log_File(ex.Message);
                Utils.Log_File(ex.StackTrace);
                string message = ex.Message;
                //this popup is not working on the deployed application
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "error from code behind", string.Format("alert('{0}')", message), true);
            }
        }

I debug my code from client side in chrome to see the error. When I debug the localhost everything works well, the popup from soapexception is displayed with this message '[E_E1] [Parameter NotFound]'

When I debug the server app, I am getting this error in chrome console :

<script type="text/javascript">
//<![CDATA[
alert('System.Web.Services.Protocols.SoapException: [E_E1] [Parameter NotFound]
    [uncaught syntaxerror unexpected token illegal]
....

解决方案

Try using ClientScript.RegisterStartupScript(this.GetType(), "Error", "alert('"+MailMessage+"');");

这篇关于显示弹出窗口,让用户在asp.net应用程序(从本地应用程序弹出显示相反从服务器上部署的应用程序弹出)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆