我是在
http://regextester.com
解析ysod,但vs抱怨语法错误。我肯定我在某个地方错过了一次逃跑,但我是一无所获。
这是原版的。如有任何帮助,我们将不胜感激。
var rxYSOD = /<!--\s*\[(.*?)]:(\s*.*\s(.*\n)*?)\s*(at(.*\n)*)-->/gs;
更新:
科比指出了明显的问题,让我再次行动。对于那些感兴趣的人来说,这是一个有效的javascript,可以测试和解析一个用于asp.net死亡黄屏(ysod)的xmlhttprequest.responsetext。
var rxYSOD = /<!--\s*\[(.*?)]:(\s*.*\s(.*[\n\r]*)*?)\s*(at(.*[\n\r]*)*)-->/;
if (rxYSOD.test(text)) {
// looks like one..
var ysod = rxYSOD.exec(text);
errObj = { Message: ysod[2], StackTrace: ysod[4], ExceptionType: ysod[1] };
}
@Kobi-这就是我想要解析HTML的结果和原因,尽管我得到了500:
{
"message": " Unknown web method ValidateUser.\r\nParameter name: methodName\r\n",
"stackTrace": "at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)\r\n at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)\r\n at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n",
"exceptionType": "ArgumentException",
"errorObject": {
"Message": " Unknown web method ValidateUser.\r\nParameter name: methodName\r\n",
"StackTrace": "at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)\r\n at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)\r\n at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n",
"ExceptionType": "ArgumentException"
},
"statusCode": 500,
"servicePath": "/Authentication_JSON_AppService.axd",
"useGet": false,
"params": {
"username": "testingUser",
"password": "testingUser",
"customCredential": null
},
"methodName": "ValidateUser",
"__typeName": "Salient.ScriptModel.WebServiceError"
}