I configured my new IIS server and hosted an asp.net site.I have some dll files in my website's folder and the users do a download of these dll files at sometime.The problem is , the dll files can not be downloaded via a browser.The directory listing shows
all the dlls but when i click to download it, browser says "The page cannot be displayed".I
have added mime type in iis for dll files.
sobinscott
Member
31 Points
109 Posts
dll files hosted in IIS can not be accessed
Jun 30, 2010 12:21 PM|LINK
Hi experts,
I configured my new IIS server and hosted an asp.net site.I have some dll files in my website's folder and the users do a download of these dll files at sometime.The problem is , the dll files can not be downloaded via a browser.The directory listing shows all the dlls but when i click to download it, browser says "The page cannot be displayed".I have added mime type in iis for dll files.
Any idea?
Thanks in advance for your reply
Ruchira
All-Star
42876 Points
7015 Posts
MVP
Re: dll files hosted in IIS can not be accessed
Jun 30, 2010 01:04 PM|LINK
Hi sobinscott,
Add the following code to your dowload button/link click in C# code.
FileInfo fileInfo = new FileInfo("filename_of_the_dll"); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment;filename=" + fileInfo.Name); Response.AddHeader("Content-Length", fileInfo.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.Flush(); Response.WriteFile(fileInfo.FullName); Response.End();
My Tech blog | TwitterPlease 'Mark as Answer' if this post helps you.sobinscott
Member
31 Points
109 Posts
Re: dll files hosted in IIS can not be accessed
Jul 04, 2012 06:21 AM|LINK
When I added the application/octet-stream MIME type in iis issue was solved.
Thank you