By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

Write Permission for folder at runtime in .NET

P: n/a
Hi,
We have an ASP.NET application which needs to write some files on the
disk. For these we need to give ASP.NET user the Write permission for
that particular folder. This is possible from Windows explorer. We
don't want to given permission from Windows Explorer. Is there any way
of giving Write permission for folder through code ? We want to assign
the Write permission for the folder at the installation time. Is it
possible ? Please let us know.

Thanks in advance,
Santaji Garwe

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Santaji, That should be just fine, if you allow asp.net to write to the
folder with the security tab in windows explorer (and remove any roles you
don't want to be able to write). Anybody wanting to write to the folder while
logged in to windows explorer would have to have logged in under the asp.net
account.

Alternatively you could look at using temorary impersonation (i.e asp.net
temporarily has elevated privaliges) to write to the folder and then revert
back to the asp.net account when you have finished. HTH jd

"Santaji" wrote:
Hi,
We have an ASP.NET application which needs to write some files on the
disk. For these we need to give ASP.NET user the Write permission for
that particular folder. This is possible from Windows explorer. We
don't want to given permission from Windows Explorer. Is there any way
of giving Write permission for folder through code ? We want to assign
the Write permission for the folder at the installation time. Is it
possible ? Please let us know.

Thanks in advance,
Santaji Garwe

Nov 19 '05 #2

P: n/a
You could call out to CALCS.EXE during the installation to set
permissions.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 6 Jul 2005 19:31:36 -0700, "Santaji" <sa*****@gmail.com> wrote:
Hi,
We have an ASP.NET application which needs to write some files on the
disk. For these we need to give ASP.NET user the Write permission for
that particular folder. This is possible from Windows explorer. We
don't want to given permission from Windows Explorer. Is there any way
of giving Write permission for folder through code ? We want to assign
the Write permission for the folder at the installation time. Is it
possible ? Please let us know.

Thanks in advance,
Santaji Garwe


Nov 19 '05 #3

P: n/a
CALCS.EXE or CACLS.EXE ... ?

There's both.

http://msdn.microsoft.com/library/de...SecNetAP02.asp

Just want to make sure of which one it is for this case.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:k2********************************@4ax.com...
You could call out to CALCS.EXE during the installation to set
permissions.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 6 Jul 2005 19:31:36 -0700, "Santaji" <sa*****@gmail.com> wrote:
Hi,
We have an ASP.NET application which needs to write some files on the
disk. For these we need to give ASP.NET user the Write permission for
that particular folder. This is possible from Windows explorer. We
don't want to given permission from Windows Explorer. Is there any way
of giving Write permission for folder through code ? We want to assign
the Write permission for the folder at the installation time. Is it
possible ? Please let us know.

Thanks in advance,
Santaji Garwe

Nov 19 '05 #4

P: n/a
Opps, good catch Juan.

I was thinking of CACLS.exe as in "change ACLs".

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 7 Jul 2005 10:37:47 -0400, "Juan T. Llibre"
<no***********@nowhere.com> wrote:
CALCS.EXE or CACLS.EXE ... ?

There's both.

http://msdn.microsoft.com/library/de...SecNetAP02.asp

Just want to make sure of which one it is for this case.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:k2********************************@4ax.com.. .
You could call out to CALCS.EXE during the installation to set
permissions.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 6 Jul 2005 19:31:36 -0700, "Santaji" <sa*****@gmail.com> wrote:
Hi,
We have an ASP.NET application which needs to write some files on the
disk. For these we need to give ASP.NET user the Write permission for
that particular folder. This is possible from Windows explorer. We
don't want to given permission from Windows Explorer. Is there any way
of giving Write permission for folder through code ? We want to assign
the Write permission for the folder at the installation time. Is it
possible ? Please let us know.

Thanks in advance,
Santaji Garwe


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.