TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Akash Dani
NA
87
24.8k
Batch file is not working in IIS?
Jul 29 2019 12:05 AM
My Code:
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.
Reply
Answers (
5
)
winform Application and ASP.NET Application with Single DB
How to implement Telerik Control asp.net Application?