在IIS 7中创建文件夹 [英] Create folders in IIS 7

查看:96
本文介绍了在IIS 7中创建文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

极客,

需要小幅验证...

Hi geeks,

Need small verification...

string root = Server.MapPath("~");
            string path = Path.GetDirectoryName(root);
            string brandname = addbrand.Text;
            bool isExists = System.IO.Directory.Exists(Server.MapPath(@"~/"+path+"/"+brandname));
            if (!isExists)
                System.IO.Directory.CreateDirectory(Server.MapPath(@"~/" + path + "/" + brandname));
            if (uploadimg.HasFile)
            {
                string FileName = Path.GetFileName(uploadimg.PostedFile.FileName);
                uploadimg.SaveAs(@root+"/Images/" + FileName);
            }



path = C:\ inetpub \ wwwroot \(要创建的新文件夹)...上面的代码在本地驱动器中起作用(在E:中创建文件夹,但是当我发布代码并放入IIS并通过IP地址访问Web应用程序时). ..代码不起作用...我的意思是未创建文件夹....
我是否需要添加任何代码段... ??



path = C:\inetpub\wwwroot\(New folder to be created)... The code above works in local drive(Creates folder in E: but when I publish code and put in IIS and access the web application via IP address... the code doesn''t work... I mean folders are not created ....
DO I need to add any code snippets...??

推荐答案

请检查以下链接以获取更多信息.祝您好运! :)

使用C#代码创建IIS 7虚拟目录
使用c#在IIS 7.0中创建虚拟目录.净
Please check below links for more info.Good Luck ! :)

Creating IIS 7 Virtual Directory with C# code
creating Virtual directory in IIS 7.0 using c#.net


这篇关于在IIS 7中创建文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆