上一篇:ASP.NET分页组件 0.1.0 >>
INI文件的操作(ASP.NET+C#)
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace CreateWebDir
{
/// <summary>
/// INIFile 的摘要说明。
/// </summary>
public class INIFile
{
public string path;
public INIFile(string INIPath)
{
path = INIPath;
}
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key,string def, StringBuilder retVal,int size,string filePath);
public void IniWriteValue(string Section,string Key,string Value)
{
WritePrivateProfileString(Section,Key,Value,this.path);
}
public string IniReadValue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section,Key,"",temp, 255, this.path);
return temp.ToString();
}
}
}
=======================================================
(二)使用示例
string iniFile = @"D:\Bug2000.ini";
if (!File.Exists(iniFile))
{
using (FileStream fs = File.Create(iniFile))
{
fs.Close();
}
}
INIFile myINI = new INIFile(iniFile);
for(i=0;i<args.Length;i++)
{
myINI.IniWriteValue("WebDir","arg"+i.ToString(),args[i]);
}
下一篇:Asp.net+Xml开发网络硬盘 >>
相关文章:
- · ASP.NET Whidbey中personalization和membership的一些特征
- · 使用更精简的代码保证 ASP.NET 应用程序的安全
- · ASP.NET Whidbey 中新的代码编译功能
- · ASP.NET的缓存技术
- · ASP.net 中的页面继承实现和通用页面的工厂模式的实现
- · ASP.NET下MVC设计模式的实现
- · 页面无限跳转间如何保存页面状态 (3)
- · 页面无限跳转间如何保存页面状态(2)
- · 页面无限跳转间如何保存页面状态(1)
- · 基于asp.net的webmenu的数据操作(5)
- · 基于asp.net的webmenu的数据操作(3)
- · 基于asp.net的webmenu的数据操作(2)
- · 基于asp.net的webmenu的数据操作(1)
- · 十天学会ASP.net之第十天
- · 十天学会ASP.net之第九天
- · 十天学会ASP.net之第八天
- · 十天学会ASP.net之第七天
- · 十天学会ASP.net之第六天
- · 十天学会ASP.net之第五天
- · 十天学会ASP.net之第四天
- · 十天学会ASP.net之第三天
- · 十天学会ASP.net之第二天
- · 十天学会ASP.net之第一天
- · 图片上传到数据库并显示(C#+Access)
- · 关于ASPNET在IIS一些问题的经验总结
- · 认识Whidbey
- · 15秒:为ASP.NET应用缓存Oracle数据
- · 用ASP.Net写一个发送ICQ信息的程序
- · ASP.NET 开发聊天室程序(英文)
- · asp.net高级教程(续)
- · asp.net高级教程
- · ASP+与ASP有什么不同
- · NET 简介、Hello World 和 .NET Runtime 一瞥
- · ASP.NET 入门的五个步骤
- · 深入讲解 ASP+ 验证
- · ASP.NET Pre-Compilation and Keep-Alive
- · 动态创建DataGrid的模版列
- · 让Asp.Net输出图形
