名字空间 system.io
using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;
using system.text;
using system.io;
namespace new_app
{
/// <summary>
/// myxml 的摘要说明。
/// </summary>
public class myxml : system.web.ui.page
{
private const string cdanme = “d:\\mydir”;
private void page_load(object sender, system.eventargs e)
{
// 在此处放置用户代码以初始化页面
my_createdirectory (cdanme);
}
public void my_createdirectory (string path)
{
try
{
// 检查目录是否存在
if (directory.exists(path))
{
response.write(“目录已经存在.”);
return;
}
// 创建目录
directoryinfo di = directory.createdirectory(path);
response.write(“目录应创建成功”);
// 删除目录
//di.delete();
//console.writeline(“目录已经删除.”);
}
catch (exception e)
{
response.write(“出现异常”);
}
finally {}
}
#region web 窗体设计器生成的代码
override protected void oninit(eventargs e)
{
//
// codegen: 该调用是 asp.net web 窗体设计器所必需的。
//
initializecomponent();
base.oninit(e);
}
/// <summary>
/// 设计器支持所需的方法 – 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void initializecomponent()
{
this.load += new system.eventhandler(this.page_load);
}
#endregion
}
}