02 2011 档案
摘要:先看一段代码 /// <summary> /// /// </summary> /// <param name="oldName"></param> /// <param name="newName"></param> /// <returns></returns> private bool RenameFilea(string oldName, string newName) { string filepath = System.IO.Directory.G
阅读全文
摘要:先看一个实例:private Dictionary<string, string> needfirstReplaces = new Dictionary<string, string>() { {"one","onemail"}, {"two","twomail"}, {"three","threemail"}, {"four","fourmail"} };protected virtual Dictionary
阅读全文
摘要:首先添加:using System.Net.Mail;代码如下,具体自己处理,以符合你的需求: public static bool SendMail(string subject, string body) { bool result = false; try { List<string> toMailList =new List<string>(){ {"sping@sina.com"}, {"springyang@sina.com"} }; if (toMailList.Count > 0) { MailMessage mail = new MailMess
阅读全文
摘要:string.Concat:参数arg0Object 或 空引用(在 Visual Basic 中为 Nothing)。返回值arg0 的值的 String 表示形式。如 string.Concat("a","b","c","d") 的值是 "abcd",作用是连接字符串.string.SubstringString.Substring (Int32) 从此实例检索子字符串。子字符串从指定的字符位置开始。如:string str = "abcdefg";str = str.Substring(3);str的结果是"efg";因为字符串索引从0开始,3其实是第四个字符.String.Substr
阅读全文
摘要:代码如下: private string GetHttpStr(string str, string httpStr) { bool Ishavevalue = false; int newlength = httpStr.Length; string newstr = null; string httpendString = "<"; if (str.Length >= newlength && str.Contains(httpStr)) { newstr = str.Substring(str.IndexOf(httpStr, StringCompariso
阅读全文
摘要:运行如下代码时发现弹出Exception from HRESULT: 0x800A03EC异常 private void ExportExcel(DataTable dt) { if (dt == null) return; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { return; } System.Globalization.CultureInfo CurrentCI = System.Thr
阅读全文
摘要:fileURL:上传文件的路地址docfile:byte[]类型的字节流private void UploadToLibrary(string fileURL, byte[] docfile) { WebRequest request = WebRequest.Create(fileURL); request.Credentials = System.Net.NetworkCredential(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["UserPassword"], Confi
阅读全文
摘要:Domain:域名,地址名;folderURL:Domain+文件夹名如下就会在Domain一个文件夹 public bool CreateFolder(string folderURL) { try { WebRequest request = WebRequest.Create(folderURL); request.Credentials = System.Net.NetworkCredential(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["UserPassword"],
阅读全文
摘要:新建一个类public class FolderBE { public string FolderOne { get; set; } public string FolderTwo { get; set; } public string FolderThree { get; set; } public string FolderFour { get; set; } public string FolderFive { get; set; } }然后 List<FolderBE> listFolder = new List<FolderBE>(); FolderB
阅读全文
摘要:首先引用Microsoft.Office.Interop.Excel;
阅读全文
摘要:private List<string> getURLFromContent(string content) { string regexStr = @"(http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?・^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])"; System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(conte
阅读全文
摘要:新建一个类public class FolderBE { public string FolderOne { get; set; } public string FolderTwo { get; set; } public string FolderThree { get; set; } public string FolderFour { get; set; } public string FolderFive { get; set; } }然后: List<FolderBE> listFolder = new List<FolderBE&am
阅读全文
摘要:Application:对象是表示用来保存所有用户(浏览器)共享的数据,直到Web服务器或pc关闭为止。共享的数据才会消失的。其实 application对象就是个应用级别的对象,用来在所有的用户之间共享信息,并可以在web应用程序运行期间持久的保持数据。同时如果不加以限制,所有的客户都可以访问这个对象。Application定义:Application["ViewUser"]=0 ;在每个用户登...
阅读全文