Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi dear all,
I have written a code for download exe file but the requirement is to run the exe file automatically.

Here is my download code...but i don't know how to run it directly after download...


C#
string newpath = "~/Debug1/ConsoleApplication1.exe";
string Filename = Path.GetFileName(filepath);
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=" + Filename + "");
Response.TransmitFile(Server.MapPath(filepath.ToString()));
Response.End();


plz guide me dear, thanx in advance..
Posted
Updated 1-Jan-14 19:19pm
v2

You cannot do it from the server-side code, as it does not have any access to the client system. Think by yourself: who would be so brave to use the Web if the sites would be given a power to execute any applications on the client site without user consent? It would be a total absurd. There is a client-side workaround for certain browsers on Windows systems, but don't even play with the idea of using it.

—SA
 
Share this answer
 
Comments
bholey 2-Jan-14 5:19am    
yes, u r absolutely right and do u have any client side functionality like javascript, jquery. or activex etc... so that i can fulfill my requirement, plz suggest me with code block.
Sergey Alexandrovich Kryukov 2-Jan-14 10:08am    
Don't do it. Is it not enough for you? I think I explain the solution and its motivation to you. If you have it as a requirement, let the person who required that talk to me. I am ready to talk only to a person who makes decisions.
—SA
Espen Harlinn 2-Jan-14 9:53am    
Good points :)
Sergey Alexandrovich Kryukov 2-Jan-14 10:08am    
Thank you, Espen.
Happy New Year!
—SA
Espen Harlinn 2-Jan-14 10:09am    
And my congratulations for yet another MVP :-)
Hi,

do you know about clickonce utility, where you can host your desktop application on IIS, and access from the clients.

Go through the below google[^] link.


Thanks
--RA
 
Share this answer
 
Comments
bholey 2-Jan-14 5:22am    
actually , I'm using webpage and want to run an exe file after downloading and i think it's possible in client side but don't know how to do it....

so any help would be appreciated....
Rajesh Anuhya 2-Jan-14 5:25am    
As per my understand, you want to run a exe on the client PC from web page link,
before that you have to download/update that exe from the server, right?
--RA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900