Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
website,i have a web form and a
button on web form ,then how to add a window form in web site and on
web form click event i want to open window form .....
i have a link of a web site in this a window form is open on web form
click event ..
i want to do same like this..
https://careeropportunity.polaris.co.in/portal/LoginPage.aspx?obj=0qKjcPeCekWJwsxZ5QavzrwX2%2ftaP9PS#dlgRegister

how to open window form on web form button click event
Posted

You can not OPEN a window form from asp.net application, but yes you can execute an windows application.

C#
using System.Diagnostics;

Process.Start("example.exe");


this code will execute on server and it iff expect that the exe is at server and will run on server only.

If you wish to execute some code on clients machine in that case you can use ActiveX Objects in Javascript.

JavaScript
function runWinZip() {
var shell = new ActiveXObject("WScript.shell");
shell.run("winzip.exe");
}

<input type="button" name="button1" value="Run Winzip" onClick="runWinZip()" />


Make sure your path of exe is correct every where.
 
Share this answer
 
Comments
Raju from lucknow 10-Jul-14 2:37am    
The code is working fine when i compile my code but when I deployee my site on IIS , it is unable to open exe file. Is there any specific changes in IIS for calling exe ?
DEar its not possible to open any sort of windows form inside your asp/html rendered page.

you can only give command to run server side program which will run on server and you need to RD to see if the process started successfully.
or
another way you can do at client side application start which will run at client machine not in browser.

and the site referenced by you is not running any kind of windows form inside the asp.net page. its purely aspx written pages.
 
Share this answer
 

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