/// <summary> /// 初始化页面 /// </summary> public void InitPage() { try { if (this.AdvertID != 0) { List <AdvertEntity> advertEntity = AdvertLogic.GetAdvertOnLineImage(AdvertID); if (advertEntity[0].AdContent.Length > 0) { Response.AddHeader("Content-Disposition", "filename=img" + AdvertID); Response.ContentType = "image/*"; Response.BinaryWrite(advertEntity[0].AdContent); Response.End(); } } else if (this.InfoCategoryID != 0) { DataTable dt = WebInfoLogic.WebInfoCategoryImage(InfoCategoryID); if (dt.Rows[0]["MiniatureName"].ToString().Length > 0) { Response.AddHeader("Content-Disposition", string.Format("filename=img{0}.jpg", this.InfoCategoryID)); Response.ContentType = "image/*"; Response.BinaryWrite((byte[])dt.Rows[0]["MiniatureName"]); Response.End(); } } } catch (Exception ex) { new MessageBoxHelper().RegisterStartupScript(string.Format("<script>winow.open('{0}');", ex.Message)); } }