0

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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)
could you post your code? if you pass full path to standard io classes they don't do anything with virtual path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.