Showing posts with label directories. Show all posts
Showing posts with label directories. Show all posts

Saturday, March 24, 2012

Permission denied creating directory

Hi,
I have a created a simple file upload asp.net web page which also creates di
rectories on the fly using the following code:
string fullpath = Server.MapPath(".\\..\\..\\" + path);
DirectoryInfo dir = new DirectoryInfo(fullpath);
if(!dir.Exists)
dir.Create();
Now the dir.Create() statement gives me a permission denied. The ASP.NET use
r has been giving full control to the directory and in IIS Admin the directo
ry has write permissions for scripts set. There is no problem in uploading t
he file to an already creat
ed directory which I find extremely weird!
What goes wrong ?
My OS is Windows XP using .NET framework 1.1. All the latest security patche
s are installed.Hi,
Does the "System" account have access?
Cheers,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Hi Christoffer:
One way to trouble shoot these types of problems is to enable auditing
and find out "who" is getting the access denied message.
See:
http://www.pluralsight.com/keith/bo...leauditing.html
and
http://www.pluralsight.com/keith/bo...fileaccess.html
Also, make sure the permissions apply to subfolders - click "Advanced"
and check the "Apply To" column.
HTH,
Scott
http://www.OdeToCode.com
On Mon, 21 Jun 2004 08:25:40 -0700, Christoffer Srensen
<ChristofferSrensen@.discussions.microsoft.com> wrote:

>Hi,
>I have a created a simple file upload asp.net web page which also creates d
irectories on the fly using the following code:
>string fullpath = Server.MapPath(".\\..\\..\\" + path);
>DirectoryInfo dir = new DirectoryInfo(fullpath);
>if(!dir.Exists)
> dir.Create();
>Now the dir.Create() statement gives me a permission denied. The ASP.NET user has b
een giving full control to the directory and in IIS Admin the directory has write pe
rmissions for scripts set. There is no problem in uploading the file to an already c
rea
ted directory which I find extremely weird!
>What goes wrong ?
>My OS is Windows XP using .NET framework 1.1. All the latest security patches are i
nstalled.
"Scott Allen" wrote:

> One way to trouble shoot these types of problems is to enable auditing
> and find out "who" is getting the access denied message.
> See:
> http://www.pluralsight.com/keith/bo...leauditing.html
> and
> http://www.pluralsight.com/keith/bo...fileaccess.html
Thanks for these links.

> Also, make sure the permissions apply to subfolders - click "Advanced"
> and check the "Apply To" column.
I have found what the problem was. The ASPNET user I added was from another
domain. Now I have added the local ASPNET user and it works.
The audit thing really helped. Thank you very much!
Kind regards,
Christoffer S?rensen

Permission denied creating directory

Hi,

I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:

string fullpath = Server.MapPath(".\\..\\..\\" + path);
DirectoryInfo dir = new DirectoryInfo(fullpath);
if(!dir.Exists)
dir.Create();

Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!

What goes wrong ?

My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.Hi Christoffer:

One way to trouble shoot these types of problems is to enable auditing
and find out "who" is getting the access denied message.

See:
http://www.pluralsight.com/keith/bo...leauditing.html
and
http://www.pluralsight.com/keith/bo...fileaccess.html

Also, make sure the permissions apply to subfolders - click "Advanced"
and check the "Apply To" column.

HTH,

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

On Mon, 21 Jun 2004 08:25:40 -0700, Christoffer Srensen
<ChristofferSrensen@.discussions.microsoft.com> wrote:

>Hi,
>I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:
>string fullpath = Server.MapPath(".\\..\\..\\" + path);
>DirectoryInfo dir = new DirectoryInfo(fullpath);
>if(!dir.Exists)
> dir.Create();
>Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!
>What goes wrong ?
>My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.
"Scott Allen" wrote:

> One way to trouble shoot these types of problems is to enable auditing
> and find out "who" is getting the access denied message.
> See:
> http://www.pluralsight.com/keith/bo...leauditing.html
> and
> http://www.pluralsight.com/keith/bo...fileaccess.html

Thanks for these links.

> Also, make sure the permissions apply to subfolders - click "Advanced"
> and check the "Apply To" column.

I have found what the problem was. The ASPNET user I added was from another domain. Now I have added the local ASPNET user and it works.

The audit thing really helped. Thank you very much!

Kind regards,

Christoffer S?rensen

Wednesday, March 21, 2012

permissoin question-iis

I have a txt file in one of my site's directories. I want my ASP program to be able to read that file but I don't want the users to be able to read it if they type the URL... what should I do?Deny anonymous access to the directory.
Originally posted by Lethal
Deny anonymous access to the directory. well! my asp.net pages are in the same directory:D I want people to be able to see my aspx pages so I dont wanna mess with the directory permissions

as for the file permissions, I denied anonymous access to it, but the problem was that asp.net couldnt access it that way :(
so I guess it's not possible... I wanted asp.net to be able to access the TXT file but I didnt want the users to be able to access it
You should be able to accomplish this using the web.config settings. Do a search for using a "location" setting. Basically it involves setting specific permissions to a path.
Or simply use the .config extension for the file, because IIS will not serve these types of files for client requests.
I dont remember too well but I read an article that said that the web.config fileo only protects aspx pages, so I dont think web.config would protect a txt file. Do what Lethal said and deny anonymous access but give the asp.net process access to it.
Originally posted by DevGrp
I dont remember too well but I read an article that said that the web.config fileo only protects aspx pages, so I dont think web.config would protect a txt file.

Yeah, I think I read something along those lines as well. Just do what lethal said...;)
I have never done it, but can't you just add the text file to its own folder, and add a web.config file in that folder denying access?
Originally posted by hellswraith
I have never done it, but can't you just add the text file to its own folder, and add a web.config file in that folder denying access?

That is what DevGrp is referring 2. He thinks it only works for aspx pages (i think i read this somewhere also)
put the text in another directory and dont give it any kind of user access?