asp.netµ÷ÓÃbatÎļþ
ÒýÓÃÃüÃû¿Õ¼ä
using System.Diagnostics;
string sPath = "d:\\test\\test.bat";
string sDict = "d:\\test\\";
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.Arguments = sPath;
psi.WorkingDirectory = sDict;
// Start the process
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
// Attach the output for reading
System.IO.StreamReader sOut = proc.StandardOutput;
proc.Close();
// Read the sOut to a string.
string results = sOut.ReadToEnd().Trim();
sOut.Close();
// Write out the results.
string fmtStdOut = "<font face=courier size=0>{0}</font>";
this.Response.Write(String.Format(fmtStdOut, results.Replace(System.Environment.NewLine, "<br />")));
Ïà¹ØÎĵµ£º
½ñÌìÒª×öºÃÒ»µãµÄµÇ½¿ò½á¹û¾ÍÏë×ö¸öÈ«¾ÖµÄÅжÏÊÇ·ñÓû§ËùÒÔÕÒÁËÒ»ÏÂÎÄÕÂ
ÕâÀïÖ¸µÄµ¥µã£¬·ºÖ¸ÔÚWEB·þÎñ¶Ë£¬Ò»¸öÕË»§Í¬Ò»Ê±¿ÌÖ»ÄÜ´æÔÚÒ»¸öƱ¾Ý£¡
´ó¼Ò¿ª·¢ÖпÉÄܶ¼Åöµ½µÄÒ»¸öÎÊÌ⣬Ôõôʹͬһ¸öÓû§£¬ÔÚͬһʱ¼äÄÚÖ»ÔÊÐíµÇ¼һ´Î¡£
ºÜ¶àÈ˶¼»áÏëµ½ÔÚÊý¾Ý¿âÖÐÓÃÒ»¸ö±êʶ×ֶΣ¬µÇ¼½øÈ¥ÖÃ1,Í˳öÖÃ0,µÇ¼ʱÅжÏÕâ¸ö×ֶΣ¬Èç¹ ......
ÔÚGlobal.asaxÖе¼ÈëÃüÃû¿Õ¼ä
<%@Global ...
<%@Import Namespace= "System.Data " %>
<%@Import& ......
ǰÕó×Ó¿ª·¢µÄÒ»¸öÏîÄ¿³ÌÐòÖУ¬×ÜÊÇ´æÔÚ³¬Ê±ÎÊÌ⣬ÎÒÔÚiisºÍweb.configÖж¼ÅäÖÃÁ˳¬Ê±Îª120·ÖÖÓ£¬µ«ÊǾ³£ÊDz»µ½40·ÖÖӾͳ¬Ê±ÁË£¬ºÜÊÇ·³ÈËÈ´¿àÓÚһֱûÓÐÕÒµ½±È½ÏºÃµÄÒ»ÖÖ·½°¸£¬ºóÀ´²éѯÁËÐí¶àÏà¹ØµÄ×ÊÁϲÅÕÒµ½Ò»¸ö¿ÉÒÔʵʩµÄ·½°¸¡£
ÕâÀïÖ÷Òª½²ÊöÒ»ÏÂweb.config¹ØÓÚsessionState½ÚµãµÄÅäÖ÷½°¸£¬sessionStateÓÐËÄÖÖģʽ£ºof ......
Private static readonly object ReflectionLock = new object();
Lock (ReflectionLock)
{
Type scriptManagerType =
Type.GetType(
"System.Web.UI.ScriptManager, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35",
false);
......
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.netÒ³ÃæÖеÄij¸öButton±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language=”javascript”> < !– function disableOtherSubmit() {
var obj ......