ReadAttachment.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:2k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- public partial class ReadAttachment : OThinker.H3.Portal.PortalPage
- {
- private string AttachmentID
- {
- get
- {
- string id = this.Request.QueryString[Param_AttachmentID];
- if (id == null || id == "")
- {
- return Data.Attachment.NullObjectID;
- }
- else
- {
- return id;
- }
- }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- OThinker.H3.Data.Attachment attachment = OThinker.H3.Server.Engine.InstanceDataManager.GetAttachment(this.AttachmentID);
- if (attachment == null || attachment.Content == null || attachment.Content.Length == 0)
- {
- this.Response.Write("附件为空");
- }
- else
- {
- // 显示该文件
- this.Response.ContentType = attachment.ContentType;
- //设置响应头和下载保存的文件名
- this.Response.AddHeader("Content-Disposition", "online;filename=" + HttpUtility.UrlEncode(attachment.FileName));
- // 显示内容
- this.Response.BinaryWrite(attachment.Content);
- this.Response.End();
- }
- }
- }
- }
- }