Groups | Blog | Home
all groups > dotnet distributed apps > september 2005 >

dotnet distributed apps : problem in downloading exe file from website


tushar.n.patel NO[at]SPAM gmail.com
9/26/2005 5:26:37 AM
hi,
i've made one .exe application in .net 1.1 and upladed to one
server. the problem is when i click on the link, instead of downloading
it like normal exe file it is opening it. i want to download the exe as
it also has some DLLs which needs to be deployed at client side b4
application starts.
anybody has any solution plz do share with me.

thanks
Michael Nemtsev
9/27/2005 12:31:29 AM
Hello tushar.n.patel@gmail.com,


FW1.1 don't give u ability to do a such thing automatically.

FW 2.0 supply ClickOnce to do it

[quoted text, click to view]
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

tjfdownsouth
9/28/2005 8:17:01 PM
I had to add some nonsense to my webpage that would tell IIS to download the
file and not try to process

private void DownloadFile(string virtualPath)
{
string filePath = Server.MapPath(virtualPath);
FileInfo targetFile = new FileInfo(filePath);
// clear the current output content from the buffer
Response.Clear();
// add the header that specifies the default filename for the
download/saveas dialog
Response.AddHeader("Content-Disposition","attachment; filename=" +
targetFile.Name);
// add the header that specifies the file size so that the browser can show
the progress
Response.AddHeader("Content_Length",targetFile.Length.ToString());
// specify that th eresponse is a stream that cannot be read by the client
and must be downloaded
Response.ContentType = "application/octet-stream";
// send the file stream to the client
Response.WriteFile(targetFile.FullName);
// stop the execution of this page
Response.End();
}

hope this helps

[quoted text, click to view]
AddThis Social Bookmark Button