摘要: protectedvoidApplication_BeginRequest(objectsender, EventArgs e){stringurl=Request.RawUrl.ToString();if(url.ToLower().IndexOf("page/bloglist/")>-1&&url.IndexOf("?")<0){intlastg=url.LastIndexOf("/");intlastdot=url.LastIndexOf(".aspx");stringnurl=S 阅读全文
posted @ 2012-03-09 08:28 Chaoa 阅读(689) 评论(0) 推荐(0) 编辑
摘要: //写一个类public class SplictPage{public static string bind(string content, string Id){string thisnr = "";string thispage = "";string[] temp = content.Trim().Split(<a href="mailto:'{@cpbcw}');">'{$cpbcw$}');</a>if (System.Web.HttpContext.Current. 阅读全文
posted @ 2012-03-09 08:26 Chaoa 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 在Asp.Net中后台实现中实现定时器功能,每过指定的时间自动执行函数功能代码如下:Global.asax 启动定时器voidApplication_Start(objectsender,EventArgse){//在应用程序启动时运行的代码System.Timers.TimermyTimer=newSystem.Timers.Timer(60000);myTimer.Elapsed+=newSystem.Timers.ElapsedEventHandler(OnTimedEvent);myTimer.Interval=60000;myTimer.Enabled=true;}privatest 阅读全文
posted @ 2012-03-09 08:26 Chaoa 阅读(389) 评论(0) 推荐(0) 编辑
摘要: ServerOS = Environment.OSVersion.ToString();//操作系统:CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");//CPU个数:CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");//CPU类型:ServerSoft = Request.ServerVariables["SERVER_SOFTWARE"];//信息服务软件:M 阅读全文
posted @ 2012-03-09 08:24 Chaoa 阅读(395) 评论(0) 推荐(0) 编辑
摘要: usingSystem.IOvoidDownload(){System.IO.FileStream r=newSystem.IO.FileStream(FileName, System.IO.FileMode.Open);//文件下载实例化//设置基本信息Response.Buffer=false;Response.AddHeader("Connection","Keep-Alive");Response.ContentType="application/octet-stream";Response.AddHeader("C 阅读全文
posted @ 2012-03-09 08:22 Chaoa 阅读(2560) 评论(1) 推荐(0) 编辑
摘要: using System.Web; public string GetLeaderInfo(string symbol){//获取高管信息的路径 XElement ele = XElement.Load("path.xml");string path = ele.Element("leader").Value;//首次读取缓存string jsoncache = HttpRuntime.Cache.Get(symbol) as string;if (jsoncache == null || jsoncache.Equals("")){ 阅读全文
posted @ 2012-03-09 08:20 Chaoa 阅读(378) 评论(0) 推荐(0) 编辑
摘要: 首先添加对程序集System.Management的引用usingSystem;usingSystem.Management;namespaceConsoleApplication1{classProgram{staticvoidMain(string[]args){ManagementClassmc=newManagementClass("Win32_NetworkAdapterConfiguration");ManagementObjectCollectionnics=mc.GetInstances();foreach(ManagementObjectnicinnics 阅读全文
posted @ 2012-03-09 08:08 Chaoa 阅读(1054) 评论(0) 推荐(0) 编辑
摘要: 在页面上用了iframe带来方便的同时也带来了麻烦,在IE6里能正常显示的iframe在其他的浏览器里确十分丑陋而不方便。为了解决 IE,Firefox,chrome,safari中iframe显示高度自适应问题上网海找了一遍,试了好几个方案都不妥,最后发现了一个可以正常解决的方案。首先加入以下的JS代码:functionstateChangeIE(_frame){if(_frame.readyState=="complete")//state:loading,interactive,complete{AutoHeight();}}functionstateChangeFi 阅读全文
posted @ 2012-03-09 08:04 Chaoa 阅读(1741) 评论(0) 推荐(0) 编辑
摘要: //通过Google API 获取天气数据 并读取存入 XML中private void CreateXML() { XmlNodeList weekList = GetWeatherXML(); string strXml = "<weather></weather>"; doc.LoadXml(strXml);foreach (var obj in weekList) { XmlNode xmlNode = obj as XmlNode; XmlElement newElem = doc.CreateElement("forecast_ 阅读全文
posted @ 2012-03-06 17:15 Chaoa 阅读(1133) 评论(0) 推荐(0) 编辑
摘要: //中英混合字符串截断 public static string getStr(string s, int l) { string temp = s; if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "zz", RegexOptions.IgnoreCase).Length <= l) { return temp; } for (int i = temp.Length; i >= 0; i--) { temp = temp.Substring(0, i); if (Regex.Replace(temp, 阅读全文
posted @ 2012-03-01 11:41 Chaoa 阅读(485) 评论(0) 推荐(0) 编辑