我在asp.net(webform) 启动了一个外部程序并且传递了参数。请问大家:被启动的程序怎样才能获取到参数呀?谢谢啦!
代码如下: string arguments = 参数; Process ps = new Process();
ps.StartInfo.CreateNoWindow = false;
ps.StartInfo.WorkingDirectory = ConfigurationManager.AppSettings["SendMailPath"];
ps.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ps.StartInfo.Arguments = arguments;
ps.StartInfo.FileName = "emailapp.exe";
ps.StartInfo.UseShellExecute = true;
ps.Start();
代码如下: string arguments = 参数; Process ps = new Process();
ps.StartInfo.CreateNoWindow = false;
ps.StartInfo.WorkingDirectory = ConfigurationManager.AppSettings["SendMailPath"];
ps.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ps.StartInfo.Arguments = arguments;
ps.StartInfo.FileName = "emailapp.exe";
ps.StartInfo.UseShellExecute = true;
ps.Start();
解决方案 »
- gridview
- 急需解决的存储过程问题
- DataGrid中的数据如何导出为文件类型为Microsoft Office Excel工作薄类型”的Excel文件
- 新手请教一个关于服务器端控件的问题
- 请问怎样将ASP.NET程序制作安装包时把.NET也一起打包进去?
- 如何在webChart自定义控件中(从WebControl中继承),设定Width,Height,backColor的默认值
- xml文件的存储问题,请教
- 一个asp问题
- 如何将参数传给sql语句?
- 怎么给DataTable中某一行设置颜色
- asp.net中一些不明白的地方
- 安装水晶报表相关控件CRRedist2008_x86遇到的问题
这个就是传递参数用的。ps.StartInfo.Arguments = ”c:\abc.txt";
ps.StartInfo.FileName = "notepad.exe";这就是命令记事本打开c盘的abc.txt文件。当然,你运行的账号要有足够权限才行。
发邮件有一命令是SendAsync(),异步发送。
或者你可以设置页面的超时时间足够长。总不至于为了这点小坑就以降低服务器的安全性为代价。