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 />")));
相关文档:
这里主要谈谈Application类中的事件
由前一篇文章可以知道,一旦出现了HttpContext类的一个实例,HttpRuntime类就会建立一个ASP.NET应用程序对象来完成该请求。一个应用程序包括HttpApplication类的一个实例。HttpApplication是一个global.asax派生的对象,处理所有被传递给某个虚文件夹得Http请求。一个正在 ......
ASP.NET用URL传递中文参数一般会失败,原因是在获取参数之后进行了编译转换。
可能过修改web.config文件让URL正常传递中文参数
在System.web节添加
<globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312"/>
即可 ......
前阵子开发的一个项目程序中,总是存在超时问题,我在iis和web.config中都配置了超时为120分钟,但是经常是不到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);
......
因为用户的一些对象, 可能在config里进行配置, 但是config怎么能随便让你添加自己的节点呢! 不行你自己试试, 在任何位置添加任何没有申明的节点, 系统都不会让你通过, 更不会让你去读它了, 当然, 你打算在别的xml文件里添加节点, 然后读出来, 创建对象, 这个没问题. 为了系统能有组织的管理用户的在配置文件里的自定义信息 ......