Downloading bin folder's dll file of ASP.Net App
I just 开发者_开发问答want to know , Is this possible to download my application's dll file from production server's bin directory...
Not via HTTP, if that's what you mean. You don't generally want to make that file available in that way.
If for some reason you want to make it available, like in some kind of code sharing scenario, I would code up a page that streams it out directly:
var fullQualifiedPathToDll = Server.MapPath("/") + "/bin/mydll.dll";
var myFileStream = new FileStream(fullQualifiedPathToDll, FileMode.Open);
var fileSize = myFileStream.Length;
var buffer = new byte[(int)FileSize];
myFileStream.Read(buffer, 0, (int)FileSize);
myFileStream.Close();
Response.BinaryWrite(buffer);
Be VERY sure that this is what you want to do when you're doing it. This is adapted from a sample found here.
Under normal circumstances, no. ASP.NET blocks requests to the bin directory.
精彩评论