javascript - To Access Notepad, calculator through asp.net - Stack Overflow

I m trying to open Notepad, Calculator in button click in asp with code behind C#. I tried with the cod

I m trying to open Notepad, Calculator in button click in asp with code behind C#. I tried with the code

 System.Diagnostics.Process.Start("c:\\windows\\system32\\notepad.exe");

this is working fine in local system but not working in the Server. I even tried with the javascript

function executeCommands(inputparms)
{
alert('ff');
var oShell = new ActiveXObject("Shell.Application");
var mandtoRun = "C:\\Winnt\\Notepad.exe";
if (inputparms != "")
{
    var mandParms = document.form1.filename.value;
}

oShell.ShellExecute(mandtoRun, mandParms, "", "open", "1");
}

even this is not working out. Can you please suggest me in on how to open the notepad application in the client end with out disturbing server notepad.

I m trying to open Notepad, Calculator in button click in asp with code behind C#. I tried with the code

 System.Diagnostics.Process.Start("c:\\windows\\system32\\notepad.exe");

this is working fine in local system but not working in the Server. I even tried with the javascript

function executeCommands(inputparms)
{
alert('ff');
var oShell = new ActiveXObject("Shell.Application");
var mandtoRun = "C:\\Winnt\\Notepad.exe";
if (inputparms != "")
{
    var mandParms = document.form1.filename.value;
}

oShell.ShellExecute(mandtoRun, mandParms, "", "open", "1");
}

even this is not working out. Can you please suggest me in on how to open the notepad application in the client end with out disturbing server notepad.

Share Improve this question asked Apr 19, 2011 at 6:05 Fairy_GFairy_G 4173 gold badges12 silver badges23 bronze badges
Add a ment  | 

6 Answers 6

Reset to default 5

This can't be done. Imagine the security mess we'd be in if a web-page could run arbitrary programs on a client machine. Oh wait... ;-)

This is not possible (in general, though you could possibly get around with with various applets and browser plugins). In fact, I would be quite mortified if any web page could execute an arbitrary program on my puter.

You cannot do this. ASP.NET runs on the server and you cannot run programs on the client puter. The ActiveX object you have shown should work but only in IE and only after the user explicitly authorizes the execution of it. Also the location of notepad.exe might differ depending on the client (could be c:\windows, c:\winnt, ... and some clients running for example on Linux or MacOS don't have such executable)

What you are trying to achieve is not possible because of the nature of application in case of ASP.Net. The application will execute on server and will only send client side HTML to client. Even if your code is syntatically correct, it would open up the utilities on server itself.

This Can be possible by using below code on click of server button or Link. System.Diagnostics.Process.Start("notepad.exe");

System.Diagnostics.Process.Start("C:\Windows\System32\calc.exe")

Works fine, though you may have to adjust settings on your browser. Be sure calc.exe is in the directory.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744721101a4589916.html

相关推荐

  • javascript - To Access Notepad, calculator through asp.net - Stack Overflow

    I m trying to open Notepad, Calculator in button click in asp with code behind C#. I tried with the cod

    14小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信