比如XXXX.aspx.cs文件内容如下:
private void Exec_Click(object sender, System.EventArgs e)
{
if (this.Page.IsPostBack && this.Page.IsValid)
{
/*
//Get path of the system folder.
string sysFolder =
Environment.GetFolderPath(Environment.SpecialFolder.System);
//Create a new ProcessStartInfo structure.
ProcessStartInfo pInfo = new ProcessStartInfo();
//Set the file name member.
pInfo.FileName = sysFolder + @"\eula.txt";
//UseShellExecute is true by default. It is set here for illustration.
*/
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.FileName = @"c:\123.txt";
pInfo.UseShellExecute = true;
Process p = Process.Start(pInfo);
}
}然后生成,接着在IE里访问这个页面,点击按钮,希望启动c:\123.txt,运行没有任何错误,可是123.txt并没有在服务器上打开!
private void Exec_Click(object sender, System.EventArgs e)
{
if (this.Page.IsPostBack && this.Page.IsValid)
{
/*
//Get path of the system folder.
string sysFolder =
Environment.GetFolderPath(Environment.SpecialFolder.System);
//Create a new ProcessStartInfo structure.
ProcessStartInfo pInfo = new ProcessStartInfo();
//Set the file name member.
pInfo.FileName = sysFolder + @"\eula.txt";
//UseShellExecute is true by default. It is set here for illustration.
*/
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.FileName = @"c:\123.txt";
pInfo.UseShellExecute = true;
Process p = Process.Start(pInfo);
}
}然后生成,接着在IE里访问这个页面,点击按钮,希望启动c:\123.txt,运行没有任何错误,可是123.txt并没有在服务器上打开!
没有权限吧?IIS用户权限不高
Process p = Process.Start(pInfo);
我想达到完全独立的运行记事本,不知道各位有什么高见?
ProcessStartInfo pInfo = new ProcessStartInfo(@"NOTEPAD.EXE",@"c:\123.txt");
//記事本 程序的名称,程序的参数
pInfo.UseShellExecute = true;
Process p = Process.Start(pInfo);
我的是VS2003,我也不知道是asp.net几,IIS5.1,我这边的确是不行,在任务管理器里面,只在进程里看到notepad,在应用程序里面看不到。