开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜