Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to develop ServerSide application, who will accept shell commands via HTTP web panel.For this i was used WebBrowser on WindowsForm.Application. Like this

ON server side i wrote this code

C#
WebBrowser1.Navigate("http://localhost/commander.html");
if(webbrowser1.document.contains("cmd"))
{
            process.start(@"cmd.exe")
        }
 if(webbrowser1.document.contains("calc"))
{
            process.start(@"calc.exe")
        }


This code works when on Webserver equals text like "cmd" but they execute to many cmd.exe . And Program not accepts live changes on webserver, and don't execute second command "calc.exe". I know for programms like this the best way to use TCP sockets, but my router not allow tcp connections between my and another user computer.

And web panel looks like

HTML
<pre><input type="text" id="commander" name="cmder" size="40"/>
<input type="submit" id="cmdsend" name "shellsend" />


Any ideas? Sorry for my English

What I have tried:

ServerSide application
C#
WebBrowser1.Navigate("http://localhost/commander.html");
if(webbrowser1.document.contains("cmd"))
{
            process.start(@"cmd.exe")
        }
 if(webbrowser1.document.contains("calc"))
{
            process.start(@"calc.exe")
        }

AND WEBPANEL SIDE
HTML
<pre><input type="text" id="commander" name="cmder" size="40"/>
<input type="submit" id="cmdsend" name "shellsend" />
Posted
Updated 20-Feb-17 12:32pm
v2
Comments
ZurdoDev 20-Feb-17 11:35am    
What is your question?
lekaton lekatyan 20-Feb-17 11:50am    
How to Create Server side.exe who will accepts commands via WEB PANEL "example.com/commander.html" and send output to the web panel?
Karthik_Mahalingam 20-Feb-17 16:33pm    
Always use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.
Richard Deeming 20-Feb-17 12:36pm    
I hope you're getting confused between "server-side" (things that run on the server) and "client-side" (things that run on the client).

Using a WebBrowser control from unattended server-side code is something that would only make sense in extremely rare circumstances, and is likely to cause serious problems.

Using it to read a static HTML file from the same computer is not one of those circumstances! :)

1 solution

Why dont you look at using something like 'NANCY' for your 'server side' application, and define a REST interface - then you could define a route

Get["/actions/{command}"]


you can then run the 'command' and return the result (possibly marked up) in the REST result/payload
 
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