Re: file sharing violation. Which permission should I give to the directory and files?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You could easily test this by just creating the text file.

Also what if several people are uisng this page roughly at the same time.
You should use a unique name for each (or think the process as suggested).

--
Patrice

"James" <jzheng22@xxxxxxxxx> a écrit dans le message de news:
1146585899.303986.66030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,

I am new to ASP.NET. I am currently working on a project with VB, .NET
1.1 on
a Windows 2000 server.
I have two files
C:\Inetpub\wwwroot\test\test.aspx
C:\Inetpub\wwwroot\test\test.exe

test.exe is a C program, it will be executed if the user click the
button in test.aspx page.

some code from test.aspx
...
Dim fname As String = Server.MapPath("test.exe")
Dim cmdline As String = fname & " > c:\temp\stdout.txt 2>
c:\temp\stderr.txt"
Dim retval As Integer
retval = Shell(Environ("COMSPEC") & " /c " & cmdline, AppWinStyle.Hide,
True, 100000)
...

I redirect stdout and stderr of test.exe to two files. Initially I want
to redirect them to
C:\Inetpub\wwwroot\test\stdout.txt, and
C:\Inetpub\wwwroot\test\stderr.txt, but failed.
It looks like the program does not have permissions to write to
C:\Inetpub\wwwroot\test\
directory. So I have to redirect them to c:\temp, where "Everyone" has
read&write
permissions, which is not secure. Even worse, the program cannot write
new data to
stdout.txt, neither can I delete the file manually. It says "There has
been a sharing
violation. The source or destination file may be in use"

My question is what kind of permissions should I give to directories
and files, and
where I should store files.

Thanks,

James



.


Quantcast