473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

creating directories

Hi,

I am having a strange problem on IIS 6.0.

I am trying to create directories under a virtual directory on the fly to
which I will upload files and retrieve these files later. I am having 2
problems:

1. I am using the code below to create a directory:

string path = Path.GetDirectoryName(context.Request.PhysicalPath );
if(!Directory.Exists(path))
Directory.CreateDirectory(path);

When I do this I get entries in the DefaultAppPool list for each directory
AND new virtual directories with the same name!

2. I am also unable to retrieve that data from these folders. I can navigate
down to the directory which holds the data but cannot access it. For example
if I started at www.someplace.com/root/ I may have added ID/IN making
www.someplace.com/root/ID/IN using the technique listed above. With
directory listing on I can navigate right down to this folder but if I then
click on the actual file that is in this folder I get a 404 error!

Can anyone shed any light on this?

Cheers
Nov 19 '05 #1
3 1453
IIS 6.0 has additional security measures to prevent you from walking down the
tree. This is most likely the cause of your second issue. The reason is to
avoid transverse hacks, where a hacker uses your code to get to a utility,
like the command shell, that allows him to take over your machine.

You can get around this security by one of two means:

1. Reduce the security on the machine - not advised
2. Move the code that does the work on the other root into a service of some
sort that is controlled via commands from your application. This is a bit
more code intensive, but does not reduce the security on Windows Server 2003
to solve a problem.

How to achieve 2:

1. Service is an option. The interface is likely to be remoting.
2. Enterprise Services (COM+) is another option, as you can give rights to
the COM+ app that the web server does not have

NOTE: No matter how you circumvent this, you will have to be careful to
authenticate the user, as you have given them some power. Also, be extremely
careful you do not leave security holes in the app that creates and controls
new virtual roots, as you may leave a hacker back door.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Stelrad Doulton" wrote:
Hi,

I am having a strange problem on IIS 6.0.

I am trying to create directories under a virtual directory on the fly to
which I will upload files and retrieve these files later. I am having 2
problems:

1. I am using the code below to create a directory:

string path = Path.GetDirectoryName(context.Request.PhysicalPath );
if(!Directory.Exists(path))
Directory.CreateDirectory(path);

When I do this I get entries in the DefaultAppPool list for each directory
AND new virtual directories with the same name!

2. I am also unable to retrieve that data from these folders. I can navigate
down to the directory which holds the data but cannot access it. For example
if I started at www.someplace.com/root/ I may have added ID/IN making
www.someplace.com/root/ID/IN using the technique listed above. With
directory listing on I can navigate right down to this folder but if I then
click on the actual file that is in this folder I get a 404 error!

Can anyone shed any light on this?

Cheers

Nov 19 '05 #2
Hi,

Thanks for the response. The first issues seems to have resolved itself, I
don't understand why, I must have been doing something pretty dumb but now I
am getting vanilla directories under the correct virtual directory with no
other weird stuff going on.

I am a bit stuck on the rest of it though. I have a custom PUT handler that
creates these directories if they do not exist before writing a file to
them. Can you clarify to me why these files will not be served? Surely it
would be servable if I had FTP'ed it up?

Thanks for your time.
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote
in message news:40**********************************@microsof t.com...
IIS 6.0 has additional security measures to prevent you from walking down
the
tree. This is most likely the cause of your second issue. The reason is to
avoid transverse hacks, where a hacker uses your code to get to a utility,
like the command shell, that allows him to take over your machine.

You can get around this security by one of two means:

1. Reduce the security on the machine - not advised
2. Move the code that does the work on the other root into a service of
some
sort that is controlled via commands from your application. This is a bit
more code intensive, but does not reduce the security on Windows Server
2003
to solve a problem.

How to achieve 2:

1. Service is an option. The interface is likely to be remoting.
2. Enterprise Services (COM+) is another option, as you can give rights to
the COM+ app that the web server does not have

NOTE: No matter how you circumvent this, you will have to be careful to
authenticate the user, as you have given them some power. Also, be
extremely
careful you do not leave security holes in the app that creates and
controls
new virtual roots, as you may leave a hacker back door.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Stelrad Doulton" wrote:
Hi,

I am having a strange problem on IIS 6.0.

I am trying to create directories under a virtual directory on the fly to
which I will upload files and retrieve these files later. I am having 2
problems:

1. I am using the code below to create a directory:

string path = Path.GetDirectoryName(context.Request.PhysicalPath );
if(!Directory.Exists(path))
Directory.CreateDirectory(path);

When I do this I get entries in the DefaultAppPool list for each
directory
AND new virtual directories with the same name!

2. I am also unable to retrieve that data from these folders. I can
navigate
down to the directory which holds the data but cannot access it. For
example
if I started at www.someplace.com/root/ I may have added ID/IN making
www.someplace.com/root/ID/IN using the technique listed above. With
directory listing on I can navigate right down to this folder but if I
then
click on the actual file that is in this folder I get a 404 error!

Can anyone shed any light on this?

Cheers

Nov 19 '05 #3
as a quick test I dropped a file into one of these directories from Explorer
and it was served properly. Does IIS keep meta infomation on files (ie how
it came to be where it was)? If so would it be possible to alter this
information from code?

Thanks

"Stelrad Doulton" <___@____.com> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
Hi,

Thanks for the response. The first issues seems to have resolved itself, I
don't understand why, I must have been doing something pretty dumb but now
I am getting vanilla directories under the correct virtual directory with
no other weird stuff going on.

I am a bit stuck on the rest of it though. I have a custom PUT handler
that creates these directories if they do not exist before writing a file
to them. Can you clarify to me why these files will not be served? Surely
it would be servable if I had FTP'ed it up?

Thanks for your time.
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM>
wrote in message
news:40**********************************@microsof t.com...
IIS 6.0 has additional security measures to prevent you from walking down
the
tree. This is most likely the cause of your second issue. The reason is
to
avoid transverse hacks, where a hacker uses your code to get to a
utility,
like the command shell, that allows him to take over your machine.

You can get around this security by one of two means:

1. Reduce the security on the machine - not advised
2. Move the code that does the work on the other root into a service of
some
sort that is controlled via commands from your application. This is a bit
more code intensive, but does not reduce the security on Windows Server
2003
to solve a problem.

How to achieve 2:

1. Service is an option. The interface is likely to be remoting.
2. Enterprise Services (COM+) is another option, as you can give rights
to
the COM+ app that the web server does not have

NOTE: No matter how you circumvent this, you will have to be careful to
authenticate the user, as you have given them some power. Also, be
extremely
careful you do not leave security holes in the app that creates and
controls
new virtual roots, as you may leave a hacker back door.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Stelrad Doulton" wrote:
Hi,

I am having a strange problem on IIS 6.0.

I am trying to create directories under a virtual directory on the fly
to
which I will upload files and retrieve these files later. I am having 2
problems:

1. I am using the code below to create a directory:

string path = Path.GetDirectoryName(context.Request.PhysicalPath );
if(!Directory.Exists(path))
Directory.CreateDirectory(path);

When I do this I get entries in the DefaultAppPool list for each
directory
AND new virtual directories with the same name!

2. I am also unable to retrieve that data from these folders. I can
navigate
down to the directory which holds the data but cannot access it. For
example
if I started at www.someplace.com/root/ I may have added ID/IN making
www.someplace.com/root/ID/IN using the technique listed above. With
directory listing on I can navigate right down to this folder but if I
then
click on the actual file that is in this folder I get a 404 error!

Can anyone shed any light on this?

Cheers


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ricco DeCicco | last post by:
Hi All I have just reinstalled VStudio.Net (VB.Net) and the .Net Framewor and I can successfully open an existing project for editin 'UserControlSample' When I try to create a new project...
3
by: dave | last post by:
I am using vs.net 2003 on windows xp. After clicking on a project within my solution and selecting create new folder vs.net responds back with , the "directory already exists". If i look at the...
6
by: Ferrari, Eduardo | last post by:
Hi all! I'm trying to create this XML file: <?xml version="1.0" encoding="utf-8" ?> <Build type="Daily" sync="True" compile="True" assemble="True" > <Sync version="1.0.0.0" branch="QA">...
6
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
1
by: Senthil | last post by:
Con is the file name for a reserved device name(i think it is for console). So you cannot create a file with name 'con'. choose some other name senthil >-----Original Message----- >Hi...
3
by: epigram | last post by:
I've been creating some toy ASP.NET apps in an effort to understand the technology. I've something odd with regards to project/solution creation. If you create a new asp.net application, it...
4
by: Gale | last post by:
when I create directory with mkdir() in PHP script I can't create any more directory inside that script I try to aplay 0777 to mkdir and chmod with no success I think the problem is with...
6
by: Charlie Bear | last post by:
i'm really stuck with this one can anyone help! i have a website that uses c#. it creates a series of directories and files from an xml source. when the xml changes, the directory that the...
0
by: david wright | last post by:
--- On Fri, 9/5/08, srinivasan srinivas <sri_annauni@yahoo.co.inwrote: this appears to be working, what where you expecting? "An upper case "S" means there is no executable permission, but...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.