1

当他们单击表单上的提交按钮时,只有少数用户出现错误,以下是例外...

异常发生在: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();
    }

无法弄清楚为什么有些用户得到错误而有些没有?

4

2 回答 2

0

我建议通过使用string.IsNullOrEmpty(..) 而不是与 string.Empty 进行比较来检查 redirectUrl。

我会假设

  var redirectUrl = documentNowSubmit.BuildDocuementSigningUrl(..)

在某些情况下返回 null!

于 2013-02-16T20:39:04.427 回答
0

当我进行字符串比较时,我忘记将 toLower 添加到我的字符串中以确保它们都是相同的大小写。我还添加了上述内容。

于 2013-02-18T18:27:41.187 回答