StreamWriter sw = File.CreateText("C:\\inetpub\\wwwroot\\StarRECON_TEST_PADSS\\Files\\" + "TESTDEL.bat");
sw.WriteLine("set _p= %-p%");
sw.WriteLine("sdelete _p 7 " + sourcePath + FileName);
sw.Close();
Process p = new Process();
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.FileName = "C:\\inetpub\\wwwroot\\StarRECON_TEST_PADSS\\Files\\" + "TESTDEL.bat";
Write(p.StartInfo.FileName);
p.StartInfo.UseShellExecute = false;
p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
Write(p.StartInfo.WorkingDirectory);
p.StartInfo.RedirectStandardError = true;
Write("Sdelete BatchFile: Start() Execution Started");
p.Start();
p.WaitForExit();
Write("Sdelete BatchFile: WaitForExit() Execution Ended");
p.Dispose();
The above code is creating .bat file correctly but the batch file is not executing in IIS but when I run it manualy its working but when I run it in IIS it is not working.
Jaish MathewsPosted Jul 29, 2019, 2:17 AM
Akash DaniPosted Jul 29, 2019, 2:04 AM
Jaish MathewsPosted Jul 29, 2019, 1:51 AM
Akash DaniPosted Jul 29, 2019, 1:49 AM
Jaish MathewsPosted Jul 29, 2019, 1:44 AM