2015-11-05 41 views
1

我试图在按钮单击上显示popup在asp.net 上。未捕获的SyntaxError:意外的令牌在asp.net中非法使用

void Btn_Click(Object sender,EventArgs e) 
{ 
string message = "**System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: ::[email protected] you are not authorized at EndPoint.Common.AuthenticateExt`(String uniqueKeyForLog, QueryLimitControlFor product) in d:\Builds\PROD\EndPoint\PROD - 5 EndPoint\src\EndPoint\Common.asmx.cs:line 141 at EndPoint.Common(ExtendConfirmParameters ConfirmParameters) in d:\Builds\PROD\EndPoint\PROD - 5 EndPoint\src\EndPoint\Common.asmx.cs:line 96 --- End of inner exception stack trace ---**" 


dialog(this.Page, "Error", message , 400); 

} 



public void dialog(Page page, string title, string message, int width) 
{ 

ScriptManager.RegisterStartupScript(page, this.GetType(), "dialog", "$('body').append($('<div>').attr({id:'dialog',title:'" + title + "'}));$('#dialog').html(' <style> .no-close .ui-dialog-titlebar-close { display: none;}</style><p>" + message + "</p>');$('#dialog').dialog({autoOpen: false,width: " + width.ToString() + ",modal: true,dialogClass: 'no-close',buttons: [{text: 'Okay',click: function() {$(this).dialog('close');$('#dialog').remove()}}]});$('#dialog').dialog('open');", true); 

} 

问:

如果我尝试在对话框

**System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: ::[email protected] you are not authorized at EndPoint.Common.AuthenticateExt`(String uniqueKeyForLog, QueryLimitControlFor product) in d:\Builds\PROD\EndPoint\PROD - 5 EndPoint\src\EndPoint\Common.asmx.cs:line 141 at EndPoint.Common(ExtendConfirmParameters ConfirmParameters) in d:\Builds\PROD\EndPoint\PROD - 5 EndPoint\src\EndPoint\Common.asmx.cs:line 96 --- End of inner exception stack trace ---** 

,显示如下消息我得到以下异常:

Uncaught SyntaxError: Unexpected token ILLEGAL 

WHI ch字符在上面的消息中意外吗?

如何解决asp.net中的问题。

任何帮助将不胜感激。

谢谢。

回答

0

你有一些无效的转义序列:

d:\Builds\PROD\EndPoint\PROD 

添加符号(@)到你的字符串前面:

string message = @"**System.Web.Services.Pro.... 
相关问题