Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Executing DOS/Unix Commands through vb.net web services

Hi,

I've created a web service to execute a simple DOS command.

here is my web service code

Dim strbatFilePath As String
strbatFilePath = "e:\gems\Dev\Supplier\cmdr.bat"
Dim fs2 As FileStream
fs2 = New FileStream(strbatFilePath, FileMode.Append)
Dim sw2 As New StreamWriter(fs2)
sw2.WriteLine("copy e:\gems\Dev\Supplier\dir.log e:\gems\Dev\Supplier\reuters")
sw2.Close()
Dim objProcess As Process
objProcess = New Process
objProcess.StartInfo.FileName = strbatFilePath
objProcess.StartInfo.CreateNoWindow = True
objProcess.StartInfo.UseShellExecute = False
objProcess.StartInfo.RedirectStandardOutput = True
objProcess.Start()
objProcess.WaitForExit()
objProcess.Close()

when ever I invoke this web service from my client windows application.

it is creating batch file, i'm suspeting the problem might be in executing the DOS command.

the "Supplier" folder has fullcontrol permissions to "IIS_WPG" Account.

but every time throughing a error called

"server was unable to process required -->Access denied."

Is this problem with the permissions?. if so what do i need to do to rectify this problem?.

thanks in advance.

Bhawani
[1298 byte] By [vanga] at [2007-11-11 9:59:12]
# 1 Re: Executing DOS/Unix Commands through vb.net web services
http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx
Phil Weber at 2007-11-11 21:45:02 >