SIGN UP MEMBER LOGIN:    
ARTICLE

How to remotely load an executable file in ASP.NET

Posted by Yuan Wang Articles | Visual C# July 26, 2006
A simple ASP.NET sample to load an executable file (or an application) remotely from internet.
Reader Level:

If you want to load an executable file (or an application) remotely, we give a simple ASP.NET with C# program.

----- one button remoteReboot.aspx file -------------

<%@ Page language="c#" Codebehind="remoteReboot.aspx.cs" AutoEventWireup="false" Inherits="Universal.Datatransfer.ExcelOracle.remoteReboot" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

 <HEAD>

  <title>remoteReboot</title>

  <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

  <meta name="CODE_LANGUAGE" Content="C#">

  <meta name="vs_defaultClientScript" content="JavaScript">

  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

 </HEAD>

 <body MS_POSITIONING="GridLayout">

  <form id="Form1" method="post" runat="server">

   <asp:Button id="Button1" runat="server"

    Text="Remote Reboot" Width="128px"></asp:Button>

  </form>

 </body>

</HTML>

----- remoteReboot.aspx.cs file -------------

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

 

namespace Universal.Datatransfer.ExcelOracle

{

          /// <summary>

          /// Summary description for remoteReboot.

          /// </summary>

          public class remoteReboot : System.Web.UI.Page

          {

                   protected System.Web.UI.WebControls.Button Button1;

 

                   private void Page_Load(object sender, System.EventArgs e)

                   {

                             // Put user code to initialize the page here

                   }

 

                   #region Web Form Designer generated code

                   override protected void OnInit(EventArgs e)

                   {

                             //

                             // CODEGEN: This call is required by the ASP.NET Web Form Designer.

                             //

                             InitializeComponent();

                             base.OnInit(e);

                   }

 

                   /// <summary>

                   /// Required method for Designer support - do not modify

                   /// the contents of this method with the code editor.

                   /// </summary>

                   private void InitializeComponent()

                   {   

                             this.Button1.Click += new System.EventHandler(this.Button1_Click);

                             this.Load += new System.EventHandler(this.Page_Load);

 

                   }

                   #endregion

 

                   private void Button1_Click(object sender, System.EventArgs e)

                   {

                             System.Diagnostics.Process myProcess1 = new System.Diagnostics.Process();

                             myProcess1.StartInfo.WorkingDirectory = Request.MapPath("~/bin");

                             myProcess1.StartInfo.FileName = Request.MapPath("~/bin/notepad.exe");  

                             myProcess1.Start();

                   }

          }

}

 

Procedures:

  1. Copy an excecutable file into your web-root bin directory, for example, notepad.exe.

  2. Window XP and Windows Server 2003 have the different settings.

    For Window XP users, edit machine.config file in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG change the userName from Machine into SYSTEM as below,

    <processModel enable="true", ..., userName="SYSTEM" password="AutoGenerate" ... maxIoThreads="20"/>

    For Windows Server 2003 users, you have to set up in a little different way. Just send me an email if you need a help.

  3. If you don't want to application to run under background,  you have to go to \Administrative Tools\Services\IIS Admin and right click Property\Logon, then click the checkbox of Allow service to interact with desktop.

If you don't set (3), your application is still loaded. But it runs under background.

After restart computer, then you can remote load the executable file from the internet.

Login to add your contents and source code to this article
share this article :
post comment
 

Hi, How can we load an executable from some network location in an intranet? say like \\msdatadomain1\Production\executable.exe Thanks

Posted by t kkk Dec 12, 2011

Hi You said that : For Windows Server 2003 users, you have to set up in a little different way. Just send me an email if you need a help. Could you let me know how to do this for Server 2003? Khurram Samad khurram.samad@gmail.com

Posted by Khurram Samad Oct 13, 2008

Hi You said that : For Windows Server 2003 users, you have to set up in a little different way. Just send me an email if you need a help. Could you let me know how to do this for Server 2003?

Posted by Khurram Samad Oct 13, 2008

sir i want 2003 server setting if any one know setiing for 2003 server setting plz send me at shakil.programming@gmail.com

Posted by shakil Sep 26, 2007

plz send reply as shakilpassion@gmail.com

Posted by shakil May 25, 2007
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor