我在项目里是通过cmd启动flashpaper转换文件的。项目在xp里部署可以正常转换,但是到server 2003死活不行,也不报异常iis管理员权限都给了。还不行。今天调了一天了,现在才回到家,还没吃饭快崩溃了。。倾家荡产求解关键代码:public static void TransformFile(string filepath)
{
string fppath = System.Configuration.ConfigurationManager.AppSettings["Flashpaper"];
string outpath = filepath.Substring(0, filepath.LastIndexOf('.')) + ".swf";
string param = fppath + " " + filepath + " -o " + outpath;
Process p = new Process();
p.StartInfo.FileName = "C:\\WINDOWS\\system32\\cmd.exe";
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;
try
{
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(param);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
throw ex;
}
}
{
string fppath = System.Configuration.ConfigurationManager.AppSettings["Flashpaper"];
string outpath = filepath.Substring(0, filepath.LastIndexOf('.')) + ".swf";
string param = fppath + " " + filepath + " -o " + outpath;
Process p = new Process();
p.StartInfo.FileName = "C:\\WINDOWS\\system32\\cmd.exe";
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;
try
{
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(param);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
throw ex;
}
}
解决方案 »
- 急~~~~~~~~~~~~~~做过短信猫的哥们来看看~~
- 求助:FreeTextBox安全检查出错,
- .net2.0循环读取文件夹中的所有.txt文件中的内容(续)
- ■■■未能读取与解决方案关联的某些属性????????
- 有什么方法可以把全局的Response内容REPLACE过滤后再输出?
- 学ASP.NET一周了.有几个分析与问题来看一下对不对.朋友们
- 如何让一个服务器端按钮在执行点击事件之前就先刷新一下当前页面?
- WIN7 旗舰版 IIS7.5 关于ASP.NET网站重定向的问题
- 多文件上传问题。高手请进!
- 为什么安装了活动目录后,net程序不能运行?
- 在VS2008中修改CSS样式表后在浏览器中请求不立刻生效(仍然是原来的样式)
- 解决EXCEL导入到SQL数据库中的错误
参考文档:
http://support.microsoft.com/kb/306158参考代码:<%@ Page Language="C#"%>
<%@ Import Namespace = "System.Web" %>
<%@ Import Namespace = "System.Web.Security" %>
<%@ Import Namespace = "System.Security.Principal" %>
<%@ Import Namespace = "System.Runtime.InteropServices" %><script runat=server>
public const int LOGON32_LOGON_INTERACTIVE = 2;
public const int LOGON32_PROVIDER_DEFAULT = 0;WindowsImpersonationContext impersonationContext; [DllImport("advapi32.dll")]
public static extern int LogonUserA(String lpszUserName,
String lpszDomain,
String lpszPassword,
int dwLogonType,
int dwLogonProvider,
ref IntPtr phToken);
[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern int DuplicateToken(IntPtr hToken,
int impersonationLevel,
ref IntPtr hNewToken);
[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool RevertToSelf();[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern bool CloseHandle(IntPtr handle);public void Page_Load(Object s, EventArgs e)
{
if(impersonateValidUser("username", "domain", "password"))
{
//Insert your code that runs under the security context of a specific user here.
undoImpersonation();
}
else
{
//Your impersonation failed. Therefore, include a fail-safe mechanism here.
}
}private bool impersonateValidUser(String userName, String domain, String password)
{
WindowsIdentity tempWindowsIdentity;
IntPtr token = IntPtr.Zero;
IntPtr tokenDuplicate = IntPtr.Zero; if(RevertToSelf())
{
if(LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, ref token) != 0)
{
if(DuplicateToken(token, 2, ref tokenDuplicate) != 0)
{
tempWindowsIdentity = new WindowsIdentity(tokenDuplicate);
impersonationContext = tempWindowsIdentity.Impersonate();
if (impersonationContext != null)
{
CloseHandle(token);
CloseHandle(tokenDuplicate);
return true;
}
}
}
}
if(token!= IntPtr.Zero)
CloseHandle(token);
if(tokenDuplicate!=IntPtr.Zero)
CloseHandle(tokenDuplicate);
return false;
}private void undoImpersonation()
{
impersonationContext.Undo();
}
</script>
希望能对你有帮助...
谢谢,但是我已经给iis分配过管理员帐号了,也不行。
2k3 下print2flash 转换成功!
vs里面debug的时候启动flashpaper进程的是administrator,部署到iis里是networkservice,不过貌似调整networkservice的访问权限没什么作用
http://blog.csdn.net/razelan/archive/2010/06/08/5655044.aspx