views:

357

answers:

1

I am in the need to create sub-folders within another website on the same server as the requesting website. How do I go about doing this?

I have tried Server.MapPath(path) but it is creating the folder within the current website.

I.E.:

websiteA on server 123 needs to create a directory within websiteB on server123.

Please help

+2  A: 

You have to set full path in order to do this, eg. c:\www\othersite\somefolder (for example you may set it as a configuration value in your web.config). Otherwise ASP.NET won't let you go above the root of your site.

However, I recommend to think twice about it, because it doesn't sound like a good pattern.

empi
I tried to set the full path but I was being return an error of invalid virtual path. And this is for in house employees only so security of that is not of a big issue (we have massive audit trails for everything)
mattgcon
could you post your code? if you pass full path to standard io classes they don't do anything with virtual path
empi
I retried your suggestion and it worked thank you
mattgcon