摘要:后台代码/// <summary> /// CommonHandler 的摘要说明 /// </summary> public class CommonHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.Expires = -1; context.Response.ContentType = "text/plain"; if (string.Equals((context.Request["ajaxmethod
阅读全文
摘要:File>>>FileStream (2种方式)方式1:FileStream fs1 = File.Open ( @"D:\集团通知.jpg" , FileMode.Open );方式2:FileStream fs2 = new FileStream ( @"D:\通知.jpg" , FileMode.Open );FileStream>>>byte[]byte [ ] b1 = new byte [ fs1.Length ];fs1.Read ( b1 , 0 , b1.Length );把文件保存到数据库中一般是F
阅读全文
摘要:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.中文翻译为:检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 800700051:在服务器上安装office的Excel软件.2:在”开始”->”运行”中输入dcomcnfg.exe启动”组件服务”3:依次双
阅读全文
摘要:为asp.net不同浏览器缓存不同版本的页面
阅读全文
摘要:下面是网上的直接复制粘贴:网址为http://hi.baidu.com/zealot886/blog/item/7364d4266a2a1555ac34dea6.html/cmtid/65ff140a660e02246159f3db这里是我自己的总结(1、用vs2010 将该解决方案的所有 项目都改为 net 2.0(方法,右击项目=》属性=》应用程序=》目标框架=》选择net 2.0)2、如果是web项目(与web网站不一样),则需要安装2005补丁(VS80sp1-KB926601-X86-ENU.exe),然后用记事本打开 该网站项目的 *.csproj 文件。查找Import文本,将下
阅读全文
摘要:1.查询语句的字符相加select ','+isnull(bossnum,'') from dbo.atestfor xml path('')2.使用模式分割字符串declare @s varchar(1000)set @s=N'1AAAA2可以了嗎BBBBB3CCCC23698好的adadasd.,,'declare @t table(ID int ,[name] varchar(100))while patindex('%[0-9]%',@s)>0 begin declare @ID varchar(10
阅读全文
摘要:Master页面子控件的初始化:先初始化Master页面包含的所有服务器控件。内容页面子控件的初始化:先初始化内容页面包含的所有服务器控件。Master页面的初始化:初始化Master页面内容页面的初始化:初始化内容页面内容页面的加载:加载内容页面(这是Page_Load事件,后跟Page_LoadComplete事件)Master页面的加载:加载Master页面(这也是Page_Load事件,后跟Page_LoadComplete事件)Master页面子控件的加载:把Master页面中的服务器控件加载到页面中内容页面子控件的加载:把内容页面中的服务器控件加载到页面中在建立应用程序时应该注意这
阅读全文
摘要:<table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td id="Main_tdLeftMenu" width="180" valign="top" style="display: block;"> <div id="CPHMiddle_body_menu"> <div cla
阅读全文
摘要:“assembly” 是dll的名称“namespace” 是命名空间 “tagprefix”在页面里的名字,比如页面里放一个 文本框,asp:textbox … 那么这里的asp 就是tagprefix 。tagprefix="FCKeditorV2" 那么就是 FCKeditorV2:控件的类名 %@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %%@ Register assembly="GMDatePicker" namespa
阅读全文
摘要:在网上找了N多相关的东西总说的不够细,现在终于找到了.可以了解web.cofig和Global.asax之间的关系以及执行的顺序.在Global.asax.cs文件中protected void Application_BeginRequest(Object sender, EventArgs e){ Application["StartTime"] = System.DateTime.Now; }再在webform1中的page_load事件中添加private void Page_Load(object sender, System.EventArgs e) { System.Date
阅读全文
摘要:1.添加ICSharpCode.SharpZipLib.dll(该组件是压缩组件)2.添加一个压缩辅助类,可以压缩多个文件using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using ICSharpCode.SharpZipLib.Zip;using ICSharpCode.SharpZipLib.Checksums;namespace CSharpZipLibHelper{ public class SharpZipLibHelper { //
阅读全文
摘要:?xml version="1.0" encoding="utf-8" ?books book titlec#入门经典/title price79.00/price authorms/author /book book title id="Best"c#高级编程/title price128.00/price authorms/author /book book title type="构架"大话设计模式/title price55.00/price author中国/author /book
阅读全文
摘要:<?xml version="1.0" encoding="UTF-8"?><books> <book> <name>哈里波特</name> <price>10</price> <memo>这是一本很好看的书。</memo> </book> <book id="B02"&g...
阅读全文
摘要:Using System.Text;byte[ ] 转换为stringbyte[ ] image;string ll = Encoding.Default.GetString(image);string 转换为byte[ ]string ss;byte[] b = Encoding.Default.GetBytes(ss);数据库中image类型的字段的处理。首先我想从数据库中读出图片(以image类型存储的), 并且写入txt文件中:private void GetImage() { string conn = "Server=192.168.0.11; User id=user; Pwd=
阅读全文
摘要:ASP.NET以及JS获取URL和IP地址HttpContext.Current.Request.Url.ToString() 并不可靠。如果当前URL为http://localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5通过HttpContext.Current.Request.Url.ToString()...
阅读全文
摘要:string fileName = ""; string filePath = Server.MapPath("");//路径 FileInfo fileInfo = new FileInfo(filePath); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Cont...
阅读全文
摘要:Date 对象用于处理日期和时间。创建 Date 对象的语法:var myDate=new Date()Date 对象会自动把当前日期和时间保存为其初始值。参数形式有以下5种: new Date("month dd,yyyy hh:mm:ss"); newDate("month dd,yyyy"); newDate(yyyy,mth,dd,hh,mm,ss); new Date(yyyy,mth...
阅读全文
摘要:今天遇到了这个问题,于是研究了一下。要解决这个问题,首先就要明白一些Session的机理。Session在服务器是以散列表形式存在的,我们都知道Session是会话级的,每个用户访问都会生成一个Session。那么服务器是怎么区分不同用户的Session?又是怎么将不同用户的Session与不同的用户绑定的呢?下面我们来研究一下,以下纯属我个人的理解,如有错误请指证。Session在服务器端是以散...
阅读全文
摘要:1.组名 () 这样的用索引 \1,(?<name>) \<name>来引用2.替换 $\1,${name}Regex.Replace(userInputString,"(Mr|Mrs)[a-z]*","$1 X");Regex.Replace(userInputString,"(?<name>Mr|Mrs)[a-z]*","${name} X");(?(exp...
阅读全文