急问:如何用程序修改默认web站点属性? 是么?我也想知道,共享一下如何?谢谢啦 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 static void SetDefaultWeb(string DefaultPath) { string _server = "localhost"; string _website = "1"; string strPath = "IIS://" + _server + "/W3SVC/" + _website +"/ROOT"; try { System.DirectoryServices.DirectoryEntry rootfolder = new DirectoryEntry(strPath); rootfolder.Properties["Path"].Value=Path.GetFullPath(DefaultPath); rootfolder.Properties["DefaultDoc"][0]="Default.aspx"; rootfolder.Properties["AccessRead"][0] =true; rootfolder.Properties["AccessExecute"][0] = false; rootfolder.Properties["AccessWrite"][0] = false; rootfolder.Properties["AppIsolated"][0]=1; rootfolder.Properties["EnableDirBrowsing"][0] = false; rootfolder.Properties["AccessScript"][0] = true; rootfolder.Properties["ContentIndexed"][0] = false; rootfolder.Properties["DontLog"][0]=true; rootfolder.Properties["AccessSource"][0]=false; rootfolder.CommitChanges(); } catch(Exception e) { throw new Exception("Can't connect to the server ["+ _server +"] ...",e); } } DateTime.Parse时间转换问题! 所有GET参数都为utf8编码,并做urlencode EXCEL 列查找问题 如何将DataGridView的光标移动到最后一行?? 关于C#的问题想请教大家啊 纯.net视频聊天软件源代码 ASP.NET+C#+ACCESS的问题 XML与Class的相互转换一定需要XSD文件吗 求一条sql语句 请教高手在C#中怎样实现简拼 答得好可以给100 一个字符串分解问题 在.NET中用不用htc
{
string _server = "localhost";
string _website = "1"; string strPath = "IIS://" + _server + "/W3SVC/" + _website +"/ROOT";
try
{
System.DirectoryServices.DirectoryEntry rootfolder = new DirectoryEntry(strPath);
rootfolder.Properties["Path"].Value=Path.GetFullPath(DefaultPath);
rootfolder.Properties["DefaultDoc"][0]="Default.aspx";
rootfolder.Properties["AccessRead"][0] =true;
rootfolder.Properties["AccessExecute"][0] = false;
rootfolder.Properties["AccessWrite"][0] = false;
rootfolder.Properties["AppIsolated"][0]=1;
rootfolder.Properties["EnableDirBrowsing"][0] = false;
rootfolder.Properties["AccessScript"][0] = true;
rootfolder.Properties["ContentIndexed"][0] = false;
rootfolder.Properties["DontLog"][0]=true;
rootfolder.Properties["AccessSource"][0]=false;
rootfolder.CommitChanges();
}
catch(Exception e)
{
throw new Exception("Can't connect to the server ["+ _server +"] ...",e);
}
}