ASP.NET C#: Create sub-folder in another website on same server
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 with开发者_StackOverflow社区in the current website.
I.E.:
websiteA on server 123 needs to create a directory within websiteB on server123.
Please help
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.
精彩评论