当他们单击表单上的提交按钮时,只有少数用户出现错误,以下是例外...
异常发生在:System.Web.HttpResponse.Redirect 消息:值不能为空。参数名称:url 来源:System.Web 堆栈跟踪:在 System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean Permanent)
用户点击 subit 然后调用返回 documentID 的 web 服务,然后重定向用户到外部站点开始文档..
这是我的代码我正在检查 URL 以确保它有一个
//If the document was successfully created then the user will be redirected to assure sign to immediately sign the document.
if (isSuccessfull)
{
//Re Directing the user to immediately sign the document. In assure sign it is called immediate presentment.
//ToDo: When testing change the ProductionBaseUrl to the SandBoxBaseURL
var redirectUrl =
documentNowSubmit.BuildDocuementSigningUrl(
ApplicationSettingsFactory.GetApplicationSettings().ProductionBaseUrl, ui_txtEmailAddress.Text,
documentResult[0].Id.ToString(),
documentResult[0].AuthToken.ToString(),
signatoryListQueryResult, string.Empty);
if (redirectUrl != string.Empty)
{
Response.Redirect(redirectUrl, false); //02/14/2013 Removed the end response true from the redirect.
//HttpContext.Current.ApplicationInstance.CompleteRequest(); //Added the complete request call..
}
else
{
throw new ArgumentNullException("redirectUrl", "User" + fullName + "-" + emailAddress + ": Document signing url is empty.");
}
}
else
{
var additionalInformation = "User name: " + userName + " Document Title: " + documentTitle +
" Template Id: " +
templateId;
throw new Exception(
"An error has occurred with the submission of your document. With the following additional information: " +
additionalInformation + " Please contact the service desk for additional help. " +
assureSignExceptionMsgs);
}
我在 Application_Error 的 global.asax 中发现了错误
它总是进入 LogAndClearException
//----------------------------------------------------------------------
// NAME: Application_Error
// CHANGE LOG:
// Date Programmer Description
//----------------------------------------------------------------------
//If the last error or associated base exception do not have value, exit immediately.
if (Server.GetLastError() == null)
{
return;
}
//Ignore 'A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll'
//This happens and is documented by Microsoft because the Server.End() is being called. This can happen when an unauthenticated user tries
//to access this site and the Response.Resirect is called or if a Response.Redirect is within a Try-Catch block.
if (Server.GetLastError().GetBaseException() is System.Threading.ThreadAbortException)
{
Server.ClearError();
return;
}
//Log the exception in addition to redirecting to the error page
LogAndClearException();
}
无法弄清楚为什么有些用户得到错误而有些没有?