System.Net.Mime.ContentDisposition.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString() { throw null; }
        public override bool Equals(object rparam) { throw null; }

Usage Example

示例#1
0
        public ActionResult DownloadFile(int Id)
        {
            MembershipHelp mHelp = new MembershipHelp(); var role = mHelp.logingUserRole(User.Identity.Name);
            var            roleId    = db.RoleMasters.Where(w => w.Name == role).Select(s => s.Id).FirstOrDefault();
            var            canDelete = (from m in db.MenuInfoes join rm in db.RoleMenuMappings on m.Id equals rm.MenuInfoId where m.MenuURL.Contains("ArtWorks") && rm.RoleId == roleId select rm.CanDelete).FirstOrDefault();

            if (!canDelete)
            {
                return(RedirectToAction("Index"));
            }

            string filename = db.ArtWorks.Where(w => w.Id == Id).Select(s => s.FileAddressInfo).FirstOrDefault();

            string filepath = AppDomain.CurrentDomain.BaseDirectory + "/Content/Uploads/Originals/" + filename;

            byte[] filedata    = System.IO.File.ReadAllBytes(filepath);
            string contentType = MimeMapping.GetMimeMapping(filepath);

            var cd = new System.Net.Mime.ContentDisposition
            {
                FileName = filename,
                Inline   = true,
            };

            Response.AppendHeader("Content-Disposition", cd.ToString());

            return(File(filedata, contentType));
        }
All Usage Examples Of System.Net.Mime.ContentDisposition::ToString