open notepade in web application c#

Run "exe" in web page using javascript asp.net c#

open notepage using javascript in asp.net
function RunNotePad() {
    var shell = new ActiveXObject("WScript.shell");
    shell.run("notepad.exe", 1, true); 
}
<asp:button id="btnopen" onclientclick="RunNotePad();return false;" runat="server" text="Open Notepad">
</asp:button>

Note :
No browsers support ActiveX except IE.
Because nobody in their right mind would allow an activeX component to be loaded from a web site unless the network is tightly controlled, and the activeX component is from a locally controlled source.

if you are run in Mozila firefox and Chrome and other browser it showing the error as Activexobject is not defined.
uncaught Reference error: activexobject is not defined

You must enable ActiveX IN IE:

  1. Click on Tools
  2. Select Internet Options...
  3. Select Security tab.
  4. Select Internet in Web content zone.
  5. Then, click on Custom Level...
  6. Go through all the ActiveX setting there, select Prompt or Enable

open notepade in web application c# open notepade in web application c# Reviewed by Bhaumik Patel on 6:30 AM Rating: 5