GetFiles, Delete

D

DavidS

I want the server page to remove PDF files created at an earlier stage by a
web page.

I'm always receiving a misleading error message - "illegal character in
path", etc..., "missing character" - when I attempt to use
Directory.GetFiles( ... ).

For example: Directory.GetFiles( "H:\*.PDF" )

It truly appears to be security issue when attempting to access the local
share for user.

I've attempted to impersonate - even as the ADMINISTRATOR - and still
failes. I've extended security permissions for the IIS process on the local
share - read/write/all.

Nothing works. Does the GetFiles(...) function work for an IIS process when
accessing a local share? If so / any examples - or what am I missing.
 
D

DavidS

I do use a UNC, i.e., \\FileServ\Users\<<login name for user>> || For
example...
\\FileServ\Users\DUser - where DUser is folder for user name DUser.

I receive "unknown user name or bad permission". Again - the remote share
I'm not able to read or delete files from. Can you suggest a way to do this?
 
D

Daniel Ulfe

FYI... if you are using "GetFiles" in a IIS Application (website)...
then you need to add the "user" "NETWORK SERVICES" to that share folder
(In a W2003 server).... a IIS Process uses that user instead of the
local user.

Daniel.
 
A

Andrew Morton

DavidS said:
I want the server page to remove PDF files created at an earlier
stage by a web page.

I'm always receiving a misleading error message - "illegal character
in path", etc..., "missing character" - when I attempt to use
Directory.GetFiles( ... ).

For example: Directory.GetFiles( "H:\*.PDF" )

The overload you need is
Directory.GetFiles("H:\", "*.pdf")

You can't specify a wildcard in the directory name.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top