protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{ System.Diagnostics.Process p = new Process(); p.StartInfo.FileName = "cmd"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; p.Start(); string strOutput = null; string s = @"C:\SWFTools\pdf2swf.exe " + Server.MapPath("~/Files/1.pdf") + " -o " + Server.MapPath("~/Files/1.swf"); p.StandardInput.WriteLine(s); p.StandardInput.WriteLine("exit"); strOutput = p.StandardOutput.ReadToEnd(); Console.WriteLine(strOutput); p.WaitForExit(); p.Close(); // lblMessage.Text = "success"; } catch (Exception ex)
{ // lblMessage.Text = ex.ToString(); }
}
}
{
if (!IsPostBack)
{
try
{ System.Diagnostics.Process p = new Process(); p.StartInfo.FileName = "cmd"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; p.Start(); string strOutput = null; string s = @"C:\SWFTools\pdf2swf.exe " + Server.MapPath("~/Files/1.pdf") + " -o " + Server.MapPath("~/Files/1.swf"); p.StandardInput.WriteLine(s); p.StandardInput.WriteLine("exit"); strOutput = p.StandardOutput.ReadToEnd(); Console.WriteLine(strOutput); p.WaitForExit(); p.Close(); // lblMessage.Text = "success"; } catch (Exception ex)
{ // lblMessage.Text = ex.ToString(); }
}
}
解决方案 »
- 有什么好方法在用户控件中解决flash路径问题
- Codeproject.com上翻译的关于Gadgets的文章
- 请问.net中如何让用户选择保存文件的目录?比如下载文件时
- 通过js验证后怎么实现将数据插入到数据库?
- textarea控件的高度随内容的增加自动增长,this.style.posHeight=this.scrollHeight;问题是:高度增长后,我怎么把textarea.height一并修改了
- 代码出现错误,请问是哪里出现问题?
- web服务器控件TableCell能否控制它的高度和宽度?
- 有没有在ASP.net页面向服务器传送1G大小文件的方法?若有,用什么方法实现?
- 我用dr.Item["password"]对不对
- 如何把<%# DataBinder.Eval(Container.DataItem, "x") %>的值赋给一个字符变量
- 存储过程中的+=如何表示??
- 求一正则 速度了
{ // lblMessage.Text = ex.ToString();
throw ex; }别吃掉异常,看看异常是什么。
文件夹操作权限
生成要有写入权限
在Web中调用EXE文件,确实会出现很多意想不到的情况。
我之前也做了类似的功能,可是发布到iis上后总会有那么一些问题。要不就是无法转换,要比就是进程无法关闭。
权限都试过了, 不行。
http://topic.csdn.net/u/20110211/00/ecb05a36-f7f0-40f8-b3b7-dc12cdae4f64.html