摘要: App.Config文件的配置<add key="SmtpServer" value="smtp.gmail.com"/><!--服务器地址--> <add key="MailFrom" value="**@gmail.com"/><!--发件人邮箱--> <add key="PassWord" value="******"/><!--发件人密码--> <add key="MailTo&q 阅读全文
posted @ 2012-08-15 09:41 xuebingz 阅读(664) 评论(0) 推荐(1) 编辑
摘要: js跨域调用wcf服务:1.在Service.cs里添加:[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)][JavascriptCallbackBehavior(UrlParameterName="jsoncallback")] public class Service{ [OperationContract] [WebGet(RequestFormat = WebMessageFormat.Json)] public strin 阅读全文
posted @ 2011-12-15 16:35 xuebingz 阅读(1228) 评论(0) 推荐(0) 编辑
摘要: 远程服务器返回了意外响应 400 Bad Request。原因在于:传输的数据量过大。解决方案:首先在客户端(client)的配置文件里:1.在节点<binding>修改传输数据的最大额度: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_USService1" closeTimeout="00:03:00" openTimeout="00:03:00" rece 阅读全文
posted @ 2011-12-15 16:19 xuebingz 阅读(5397) 评论(3) 推荐(0) 编辑
摘要: public void ReadPDF(string category) { string pathD = @"D:/pdf/" + category; if (File.Exists(pathD)) { byte[] bts = File.ReadAllBytes(pathD);//把pdf文件转换为二进制流 string base64String = Convert.ToBase64String(bts);//把二进制流转换为base64 byte[] newbts = Convert.FromBase64String(base64String);//把base64转化 阅读全文
posted @ 2011-10-13 15:43 xuebingz 阅读(329) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 将word转换为pdf /// </summary> public void DOCConvertPDF() { Microsoft.Office.Interop.Word.Application appClass = new Microsoft.Office.Interop.Word.Application(); appClass.Visible = false; Object missing = System.Reflection.Missing.Value; Document wordDoc = new Document(); 阅读全文
posted @ 2011-10-13 15:41 xuebingz 阅读(392) 评论(1) 推荐(0) 编辑
摘要: WebClient webClient; Uri urimx = new Uri("http://.............."); string path2 = @"D:\Text\"; webClient = new WebClient(); webClient.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于对向Internet资源的请求进行身份验证的网络凭据。 Byte[] pageData = new Byte[] { }; try { pageData = webClient 阅读全文
posted @ 2011-10-13 10:16 xuebingz 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1.在Gridview的事件RowDataBound中添加 if(e.Row.RowType==DataControlRowType.DataRow) { e.Row.Attributes["OnClick"]=ClientScript.GetPostBackEventReference(e.Row.Parent.Patent,"Select$"+e.Row.RowIndex); } 阅读全文
posted @ 2011-08-03 15:35 xuebingz 阅读(443) 评论(1) 推荐(0) 编辑
摘要: 1.设置GridView的属性AllowPaging的值为Ture;2.设置Gridview的属性PageSize;(PageSize是每页显示的行的数目,默认为10)3.设置GridView的属性PagerSettings里的Mode;4.GridView的事件PageIndexChanging ; protected void gvsecurityList_PageIndexChanging(object sender, GridViewPageEventArgs e) { gvsecurityList.PageIndex = e.NewPageIndex; GetTradeList(); 阅读全文
posted @ 2011-07-28 09:35 xuebingz 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1.添加命名空间 using System.Web; 2. 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.Equa 阅读全文
posted @ 2011-07-20 11:16 xuebingz 阅读(295) 评论(1) 推荐(1) 编辑
摘要: 1.建一个类库Constracts,在内写接口: [ServiceContract(Name = "USService", Namespace = "http://www.new.net/")] public interface IUSInfoServices { //获取高管信息 [OperationContract] string GetLeaderInfo(string symbol); }2.再建一个类库Services,在里面写实现接口的方法: 1)添加引用,添加Constracts的引用 2)实现接口: /// <summary> 阅读全文
posted @ 2011-07-20 11:11 xuebingz 阅读(1401) 评论(1) 推荐(0) 编辑