여기 GetSourceAttachment 메서드에 대한 단어 파일을 다운로드하는 중입니다. 빈 바이트를 반환하는이 메서드는 다음 바이트 첨부 배열에 오류가 발생합니다 (개체 참조가 개체의 인스턴스를 설정하지 않음). 오류. 하나는 내가 바이트 배열을 초기화하고 길이를 확인 기본값으로 나를 도울 수 있습니다.바이트 배열이 비어 있는지 확인하는 방법?
try
{
byte[] Attachment = null ;
string Extension = string.Empty;
ClsPortalManager objPortalManager = new ClsPortalManager();
Attachment = objPortalManager.GetSourceAttachment(Convert.ToInt32(hdnSourceId.Value), out Extension);
if (Attachment.Length > 0 && Attachment != null)
{
DownloadAttachment("Attacment", Attachment, Extension);
}
else
{
ClientScript.RegisterStartupScript(typeof(Page), "SymbolError", "<script type='text/javascript'>alert('Attachment is not Uploaded !');</script>");
}
}
catch
{
}
감사 매튜 왓슨 ... – SANDEEP