ASP.NET C#:在同一服务器上的另一个网站中创建子文件夹
我需要在与请求网站同一服务器上的另一个网站中创建子文件夹。我该怎么做呢?
我尝试过 Server.MapPath(path) 但它正在当前网站内创建文件夹。
IE:
服务器 123 上的 websiteA 需要在服务器 123 上的 websiteB 中创建一个目录。
请帮忙
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须设置完整路径才能执行此操作,例如。 c:\www\othersite\somefolder (例如,您可以将其设置为 web.config 中的配置值)。否则,ASP.NET 不会让您访问站点的根目录之上。
不过,我建议三思而后行,因为这听起来不是一个好的模式。
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.