Burada GetSourceAttachment yönteminin word dosyasını indiriyorum. Bu yöntem boş baytları döndürdüğünde, sonra bayt Eklenti dizisi bir hata verir (Nesne başvurusu nesnenin ayarlanamadığı). Eğer koşulu varsa Ek'in uzunluğunu kontrol ettiğimde hata. Herhangi biri, bayt dizisini varsayılan olarak başlatmak için bana yardımcı olabilir, sonra uzunluğu kontrol edin.Bayt dizisi boş olarak nasıl kontrol edilir?
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
{
}
Teşekkür Matthew Watson ... – SANDEEP