- Rongsen.Com.Cn 版权所有 2008-2010 京ICP备08007000号 京公海网安备11010802026356号 朝阳网安编号:110105199号
- 北京黑客防线网安工作室-黑客防线网安服务器维护基地为您提供专业的
服务器维护
,企业网站维护
,网站维护
服务 - (建议采用1024×768分辨率,以达到最佳视觉效果) Powered by 黑客防线网安 ©2009-2010 www.rongsen.com.cn
作者:黑客防线网安ASP维护基地 来源:黑客防线网安ASP维护基地 浏览次数:0 |
之前不是写了windows服务吗,需要向系统注册服务,但是我只有ftp权限怎么办,不能远程到桌面。
想了个办法,写了一个aspx页面,通过代码调用cmd来运行。当然,因为服务器安全放的比较开,内网吗~
下面代码
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CMD.aspx.cs" Inherits="Test_CMD" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="目录:"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" Width="549px">c:\</asp:TextBox>
<br />
<asp:TextBox ID="TextBox1" runat="server" Height="113px" TextMode="MultiLine" Width="600px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="DO" /><br />
<asp:TextBox ID="TextBox2" runat="server" Height="150px" TextMode="MultiLine" Width="600px"></asp:TextBox></div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CMD.aspx.cs" Inherits="Test_CMD" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="目录:"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" Width="549px">c:\</asp:TextBox>
<br />
<asp:TextBox ID="TextBox1" runat="server" Height="113px" TextMode="MultiLine" Width="600px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="DO" /><br />
<asp:TextBox ID="TextBox2" runat="server" Height="150px" TextMode="MultiLine" Width="600px"></asp:TextBox></div>
</form>
</body>
</html>
view plaincopy to clipboardprint?
后台
后台view plaincopy to clipboardprint?
<PRE class=csharp name="code">using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
using System.IO;
using System.Text;
public partial class Test_CMD : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox2.Text = Cmd(TextBox1.Text);
}
private string Cmd(string strExec)
{
string rl;
String
我要申请本站:N点 | 黑客防线官网 | |
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479 |