Permission to Create a File in VB .Net

F

fripper

When testing a VB .Net application on my system (with IIS installed) I get
an error message when using the fileopen function and the file does not
exist ... i.e. I want fileopen to create the file. The message I get is:

* * * * *
Access to the path "c:\inetpub\wwwroot\_private\(filename)" is denied.

The ASP.NET process is not authorized to access the requested resource. For
security reasons the default ASP.NET process identity is
'{machinename}\ASPNET', which has limited privileges. Consider granting
access rights to the resource to the ASP.NET process identity.

* * * * *

Now, HELP for the fileopen function says:

" When writing to files, an application may need to create a file if the
file to which it is trying to write does not exist. To do so, it needs
permission for the directory in which the file is to be created."

I do not understand how to give "permission for the directory" to an
application. If the file that fileopen addresses already exists everything
works OK.

Can someone help me understand how to give the appropriate permission such
that any user of the application will be able to create the file (if it
doesn't already exist)?

Thanks very much.
 
R

Ray Cassick \(home\)

All ASP.NET application run under a specific user account. You can do one of
the following:

1) Give this user (ASPNET) the correct access to the folder where you are
trying to create the file.

2) Use impersonation around the code that creates the file to make your
user look like one that does have the access.

Personally for simple things I like #1
 
F

fripper

Thanks very much ... works fine now (used Method 1). I plan to learn about
impersonation now that you bring it up.
 
R

Ray Cassick \(home\)

Glad I could help.

fripper said:
Thanks very much ... works fine now (used Method 1). I plan to learn about
impersonation now that you bring it up.

one
 

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