I have tried to read https://www.daniweb.com/programming/web-development/threads/386380/cannot-run-exe-files-in-asp-net-application but still lost in trying to achieve something. I installed the latest .net framework, and IIS on the latest updated windows 11. I wish to achieve the following:
Have a webpage with a button, when pressed, it will launch a webpage that runs a server side exe (eg, notepad.exe or ribbons.scr), while at the same time run the same exe on the local client pc.
For my attached source files, i dont know why the index.cshtml doesnt show a button. Also disappointingly the notepad.exe did not run even when i set it to have security permissions so let everyone have all rights. im a little confused why there were 2 web.config files, and the IIS interface didnt seem to match the web.config settings, and also i dont understand why the visual studio code will launch the site with a certain port number, while your previous discussion 13 years ago suggested to use the session state to run at a different port.
Thank you for reading!

while at the same time run the same exe on the local client pc.

Not possible.

commented: i guess for local app launch it can be done via javascript inside the html? +0

No, Javascript cannot run/start executables on the client machine.

commented: Thanks for being clear on this issue. +17

I see pritaeas has answered so I'll move to the next stage of the discussion which is to ask what you need in your web site.

For example there is an "online notepad" which does some basic notepad work. And there are many screensavers that run from a webpage with an example at whitescreen.online .

You can get there.

Why does the following code dont run and launch the exe I specify (eg, notepad.exe, or ribbons.scr)?

<%@ Language="VBScript" %>
<!DOCTYPE html>
<html>
<Body>

<%
Dim objShell
Dim command
Dim result

' Path to the executable
command = "C:\inetpub\wwwroot\ribbons.scr"

' Create a shell object
Set objShell = Server.CreateObject("WScript.Shell")

' Run the executable
result = objShell.Run(command, 1, True)
'result = objShell.Run(command)
'result = objShell.Exec(command)       



' Clean up
Set objShell = Nothing

' Output the result
Response.Write("Executable executed with result: " & result)
%>

</body>
</html>

Are you sure IIS is configured to allow running external scripts?

The document folder and asp file has security permission set to ALL rights for 'everyone'. In IIS, under handler mappings for .asp files, under request restriction/access, script was chosen (not execute)

for feature permissions, all 'read' 'script' 'execute' are chosen

I see pritaeas has answered so I'll move to the next stage of the discussion which is to ask what you need in your web site.

For example there is an "online notepad" which does some basic notepad work. And there are many screensavers that run from a webpage with an example at whitescreen.online .

You can get there.

Actually it has nothing to do with screensaver or notepad. My boss just asked me to create a prototype as proof of concept. There is no specific language/tool I must use. The prototype is to demonstrate that I can wirelessly control a hardware product with its own computer touch screen. My thought is that the hardware product can be seen as a notebook computer that has a web server installed. It is connected only to a wifi router without internet connection. Its IP is set to be 192.168.0.2 whereas the router being 192.168.0.1. My computer will use wifi to connect to the SSID of the router connected to the product. My thought is maybe to demonstrate that i can use my web browser to connect to the webpage http://192.168.0.2. If I click a button on that HTML page, it can run something, such as a ribbon screensaver. My boss also wanted me to setup demo so that not only the remote execution runs, but i can at the same time, run a local program similar or same as the software on the remote notebook (eg, a screen saver).

commented: Until you understand that you can't launch .exe's on my PC from a web page, we have to wait for you to catch up. +17

Let me expand on what rproffitt said, by explaining why.

If a webpage could run a program installed on another computer, the entire world wide web would be hacked into tiny pieces and cease to exist.
No one would ever use the web, it would be so totally insecure.

So web pages are prohibited from running programs on your computer. They can run a script on the webserver however. Say a PHP script to handle data transfers such as access a database on the server. Or a javascript to alter the web page if you interact with it. Or the web page can let you download and install a program. But not take over your computer.

https://xyproblem.info/

  • User wants to do X.

Sometime later...

My boss just asked me to create a prototype as proof of concept. There is no specific language/tool I must use

  • User asks for help with Y.

Initially asked...

Have a webpage with a button, when pressed, it will launch a webpage that runs a server side exe (eg, notepad.exe or ribbons.scr), while at the same time run the same exe on the local client pc.

So, if you'd stated your initial requirement rather than asking how to fix your unworkable approach, we might have gotten somewhere.

You want something like this:
https://en.wikipedia.org/wiki/Remote_procedure_call

There are multiple ways of doing this.

Can you be more specific about what your "hardware product" is. Because "can be seen as a notebook computer" suggests it isn't a notebook computer at all, but maybe something akin to a glorified point of sale terminal.

  • Does it have an operating system on it?
  • Are you able to install software on it?

No, Javascript cannot run/start executables on the client machine.

Technically correct but there are ways around it. For example, save a file in a special folder on the target computer, which has a folder watch on that folder. The watching task could then trigger a local task.

Why your approach isn’t working
What you're trying to do is mostly blocked by modern security rules — for good reasons. Here's the breakdown:

Running a .exe on the server
You can technically make the server launch an .exe file like Notepad, but:

It will run in the background on the server, not visibly on the desktop.

It needs special permissions to run, and the IIS app is very restricted by default.

Programs with a visual interface (like Notepad) usually won’t display anything because they’re being launched in a non-interactive session.

Running a .exe on the client (user’s computer)
This is completely blocked by web browsers unless:

The user downloads and runs the .exe themselves.

Or, you create a special browser plugin or extension (which is complex and often not supported anymore).

Websites are not allowed to run apps on someone’s computer directly — it’s a huge security risk.

Why your webpage button might not be working
The page might not be properly linked to the logic that runs the .exe.

If the button doesn’t even appear, it could be an HTML/CSS issue, or the file isn’t loading.

Make sure the app is being served correctly and the button is inside the right page layout.

About the web.config confusion
Having two web.config files is normal in ASP.NET apps. One controls the overall app, the other can apply to subfolders.

If IIS doesn’t seem to match what’s in web.config, it could be due to caching or differences in how IIS reads settings versus Visual Studio.

Why the port number is different
When you run your site in Visual Studio, it uses a development web server (Kestrel or IIS Express), which picks a random port. In production, IIS will usually use port 80 or 443.

Best approach
If you want a button that launches an app:

On the server: Only for background tasks, not for opening windows.

On the client: You need a download link, or a desktop app they install.

Why your approach isn’t working
What you're trying to do is mostly blocked by modern security rules — for good reasons. Here's the breakdown:

Running a .exe on the server
You can technically make the server launch an .exe file like Notepad, but:

It will run in the background on the server, not visibly on the desktop.

It needs special permissions to run, and the IIS app is very restricted by default.

Programs with a visual interface (like Notepad) usually won’t display anything because they’re being launched in a non-interactive session.

Running a .exe on the client (user’s computer)
This is completely blocked by web browsers unless:

The user downloads and runs the .exe themselves.

Or, you create a special browser plugin or extension (which is complex and often not supported anymore).

Websites are not allowed to run apps on someone’s computer directly — it’s a huge security risk.

Why your webpage button might not be working
The page might not be properly linked to the logic that runs the .exe.

If the button doesn’t even appear, it could be an HTML/CSS issue, or the file isn’t loading.

Make sure the app is being served correctly and the button is inside the right page layout.

About the web.config confusion
Having two web.config files is normal in ASP.NET apps. One controls the overall app, the other can apply to subfolders.

If IIS doesn’t seem to match what’s in web.config, it could be due to caching or differences in how IIS reads settings versus Visual Studio.

Why the port number is different
When you run your site in Visual Studio, it uses a development web server (Kestrel or IIS Express), which picks a random port. In production, IIS will usually use port 80 or 443.

Best approach
If you want a button that launches an app:

On the server: Only for background tasks, not for opening windows.

On the client: You need a download link, or a desktop app they install.

Thank you, I have abandoned this approach and do something else, this time a python prototype suggested by POE AI:

Creating a software prototype for remote control of another computer involves several technical aspects, including networking, security, and user interface design. Below, I’ll outline a simple prototype using Python with the socket library to demonstrate basic remote control functionality. This example will allow one computer to send commands to another computer.

Disclaimer

This prototype is for educational purposes only. Using remote control software without permission is unlawful and unethical. Always ensure you have consent before accessing another computer.

Requirements
  • Python 3.x
  • pyautogui library for controlling the mouse and keyboard
  • socket library (included with Python)
Step 1: Install Required Libraries

Make sure you have pyautogui installed:

pip install pyautogui
Step 2: Create the Server (Remote Control Target)

This script will run on the computer you want to control.

# server.py
import socket
import pyautogui

def main():
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_socket.bind(('0.0.0.0', 9999))  # Listen on all interfaces on port 9999
    server_socket.listen(1)
    print("Waiting for a connection...")

    conn, addr = server_socket.accept()
    print(f"Connection from {addr} has been established!")

    while True:
        command = conn.recv(1024).decode('utf-8')
        if command.lower() == 'exit':
            break
        elif command.startswith('move'):
            _, x, y = command.split()
            pyautogui.moveTo(int(x), int(y))
        elif command == 'click':
            pyautogui.click()
        elif command.startswith('type'):
            _, text = command.split(' ', 1)
            pyautogui.typewrite(text)

    conn.close()
    server_socket.close()

if __name__ == "__main__":
    main()
Step 3: Create the Client (Controller)

This script will run on the computer you’re using to control the other one.

# client.py
import socket

def main():
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect(('REMOTE_IP_ADDRESS', 9999))  # Replace with the server's IP address

    while True:
        command = input("Enter command (move, click, type, exit): ")
        if command == 'exit':
            client_socket.send(command.encode('utf-8'))
            break
        client_socket.send(command.encode('utf-8'))

    client_socket.close()

if __name__ == "__main__":
    main()
Step 4: Running the Prototype
  1. Run the Server:

    • On the target computer, run server.py:
      python server.py
  2. Run the Client:

    • On your controlling computer, run client.py:
      python client.py
    • Replace 'REMOTE_IP_ADDRESS' in client.py with the actual IP address of the target computer.
Example Commands
  • Move the mouse: move 100 200
  • Click: click
  • Type text: type Hello, World!
  • Exit: exit
Security Considerations
  • This prototype does not include any security measures. In a real application, you would need to implement authentication, encryption, and possibly a secure connection (e.g., using SSL/TLS).
  • Ensure the firewall settings allow the specified port (9999 in this case).

(LENNY:)
OK NOW, I connect two computers over its own independent wifi router. The router is 192.168.0.1. The client computer is 192.168.0.3, server is 192.168.0.2. I inputed the server IP into the sample code. I turned off all firewalls and installed python on both windows 11 computers. When I run the command "python server.py" on the server pc, it held for a second, then released back to the command prompt. When I run the command "python client.py" on the client pc, it waited a few seconds, then output the error:
C:\Users\maxwi>python client.py
Traceback (most recent call last):
File "C:\Users\maxwi\client.py", line 18, in <module>
main()


  File "C:\Users\maxwi\client.py", line 6, in main
    client_socket.connect(('192.168.0.2', 9999))  # Replace with the server's IP address
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond


So, what is wrong here? I felt so stupid I couldnt even get a sample demo running!!

Pritaeas answered the question: normal WEB security settings forbids launching executables on a client machine. The only legal workaround is to create windows service (daemon in Linux environment), install it on client machine and listen for some commands coming from server over WEB sockets.

Pritaeas answered the question: normal WEB security settings forbids launching executables on a client machine. The only legal workaround is to create windows service (daemon in Linux environment), install it on client machine and listen for some commands coming from server over WEB sockets.

Sure, I understand, but for my above new program it has nothing to do with web. It is just a python script but it still doesnt work. Do you have any insight or clue what is wrong?

commented: "IIS" is a web server. And again a browser will not launch notepad.exe +17
commented: You need to update IIS security settings, enable CGI mode. These operations will allow to run EXE on machine where IIS is installed. +0

When I run the command "python server.py" on the server pc, it held for a second, then released back to the command prompt.

So did it even give you print("Waiting for a connection...") ?

Consider making your server main like this.

if __name__ == "__main__":
    print('Server Begin')
    main()
    print('Server End')

You can add more prints in the main() function itself to try and diagnose the point of failure.

Your client failed with the timeout because your server isn't running.

A very basic test: At the console prompt on your client machine, type ping 192.168.0.2

When I run the command "python server.py" on the server pc, it held for a second, then released back to the command prompt.

So did it even give you print("Waiting for a connection...") ?

Consider making your server main like this.

if __name__ == "__main__":
    print('Server Begin')
    main()
    print('Server End')

You can add more prints in the main() function itself to try and diagnose the point of failure.

Your client failed with the timeout because your server isn't running.

A very basic test: At the console prompt on your client machine, type ping 192.168.0.2

i can ping 192.168.0.2 successfully, but as i said disappointingly the python server.py command didnt output any text before returning control to command prompt even if i added the suggested code print('server begin').
Could it be due to some modules/libraries missing/not installed??

I ran the command echo %PATH% and the output did not have the word "python" anywhere. Even if i run the setup and ticked the option "add to path", the echo %PATH% command didnt seem to show what i expected.

I fixed the problem by ensuring the path is including python. Also on the server I must run pip install
Thank you all
All working now

commented: Good job! +16

Congrats on getting going.

Even if i run the setup and ticked the option "add to path", the echo %PATH% command didnt seem to show what i expected.

Yeah, this won't transform the PATH of any existing process.

In increasing annoyance order, you may have to:

  1. Start a new cmd window
  2. Log out and log in again
  3. Reboot the machine
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.