最近,我在服務器中託管的應用程序中遇到了這些異常。當我重新啓動IIS的網站時,錯誤得到糾正。但我不知道導致此異常的序列,因爲我無法調試代碼(因爲它託管在服務器中)。該應用程序在本地工作正常,沒有引發異常。我檢查了我的後端。它也是完美的。我確實爲我的應用程序中發生的所有錯誤保留了堆棧跟蹤。我會把拋出的異常提供給你參考。C#索引超出了數組的範圍
消息
Exception of type `'System.Web.HttpUnhandledException'` was thrown.
源
的System.Web
堆棧
at System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
ASP.admin_editvideos_aspx.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
消息
Index was outside the bounds of the array.
源
App_Web_kys31898
堆棧
at EditVideos.SetSpanAndLabelValues(Video aVideo, EduvisionUser auser) at
EditVideos.AssignVideoDetailsToControls(Video aVideo, EduvisionUser auser) at
EditVideos.SetValue(Int32 videoId, Int32 categoryId) at
EditVideos.SetValuesOnPageLoad() at EditVideos.Page_Load(Object sender, EventArgs e) at
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t,
EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
C#代碼:
private void SetSpanAndLabelValues(Video aVideo, EduvisionUser auser)
{
string uploadedDate = aVideo.UploadedDate.ToString();
string[] dateTimeValue = uploadedDate.Trim().Split(' ');
string dateFormat = CommonUtilities.GetCultureDateFormat(dateTimeValue[0]);
spn_UploadedDate.InnerHtml = dateFormat + ' ' + dateTimeValue[1] + ' ' + dateTimeValue[2];
spnUploader.InnerHtml = aVideo.Title;
spnvideotitle.InnerHtml = ReadUserMessage("DisplayVideoTitle", "VideoTitle").Replace("#title#", aVideo.Title);
spanVideoTitle.InnerHtml = ReadUserMessage("DisplayVideoTitle", "VideoTitle").Replace("#title#", aVideo.Title);
spnviewermail.InnerHtml = ReadUserMessage("EditVideos", "MailOption").Replace("#Mail#", auser.Email);
spnmailvalue.InnerHtml = auser.Email;
spnUploaderName.InnerHtml = auser.FirstName;
SetVideoFileNameSpan(aVideo);
SetThumbnailFileNameSpan(aVideo);
if (aVideo.LastUpdatedDate.HasValue)
{
string LastUpdatedDate = aVideo.LastUpdatedDate.ToString();
string[] updatedDateTimeValue = LastUpdatedDate.Trim().Split(' ');
string cultureDateFormat = CommonUtilities.GetCultureDateFormat(updatedDateTimeValue[0]);
lblUploadedDate.Text = cultureDateFormat + ' ' + updatedDateTimeValue[1] + ' ' + updatedDateTimeValue[2];
}
else
{
lblUploadedDate.Text = "Not yet updated";
}
}
如果您覺得這個問題很模糊,我可以提供更多信息。請幫我找出例外的原因。
感謝
歡迎使用Stackoverflow,請使用{}包含任何代碼部分或特殊類型的文本。 –
請提供編輯視頻的代碼。SetSpanAndLabelValues – onof
@ kalyan。謝謝,我從現在開始做。 – AUSTIN