随笔分类 -  .NET开发

摘要:最近在写服务器端web上传的接口。但一直报错,上传不上去,后来发现是在分隔符中出现的问题。错误的写法: var boundary = "---------------" + DateTime.Now.Ticks.ToString("x"); var beginB... 阅读全文
posted @ 2014-04-23 16:19 Shikyoh 阅读(1077) 评论(1) 推荐(1) 编辑
摘要:public static void GenerateCanvas(string imgSaveName, int canvasWidth, int canvasHeight, string imgData) { try { if (string.IsNullOrEmpty(imgData)) return; if (imgData.StartsWith("data:image/png;base64") == false) return; ... 阅读全文
posted @ 2014-03-18 21:41 Shikyoh 阅读(2092) 评论(0) 推荐(0) 编辑
摘要:思路:将文字生成图片,再加载此图片伸缩至需要大小。首先要获取文字的实际大小。宽度高度,再通过图片缩放就OK了 public static void DrawText() { Font f = new Font("Aris", 15, FontStyle.Italic | FontStyle.Strikeout); string s = "我的测试"; Bitmap b = new Bitmap(1, 1); Graphics g = Graphics.FromImage(b); ... 阅读全文
posted @ 2014-02-28 00:43 Shikyoh 阅读(623) 评论(0) 推荐(0) 编辑
摘要:1.切图drowg.DrawImage(productImg1, new System.Drawing.Rectangle(30, 30, 300, 300), new System.Drawing.Rectangle(0, 0, 100, 100), System.Drawing.GraphicsUnit.Pixel);2个Rectangle的理解。之前对这个理解有误。(将2个区域的作用理解反了。)来理解下这2个Rectangle的意思。。先看第二个第二个Rectangle。(new System.Drawing.Rectangle(0, 0, 100, 100))切图,表示将原图从x:0, 阅读全文
posted @ 2014-02-07 14:19 Shikyoh 阅读(207) 评论(0) 推荐(0) 编辑
摘要:1。获取HTMLdocument.getElementById(Iframe的名称).contentWindow.getHTML();在线API http://www.ewebeditor.net/demo/clientapi.asp已经很详细了。 阅读全文
posted @ 2014-01-03 11:20 Shikyoh 阅读(258) 评论(0) 推荐(0) 编辑
摘要:private ArrayList GetSeparateSubString(string mOrigianlString, int subStringCharNumber) { ArrayList resultList = new ArrayList(); string tempStr = mOrigianlString; int charNumber = subStringCharNumber; int totalCount = 0; string mS... 阅读全文
posted @ 2013-12-27 11:22 Shikyoh 阅读(369) 评论(0) 推荐(0) 编辑
摘要:String.Format("{0} world!","hello") //将输出 hello world!,没有问题,但是只要在第一个参数的任意位置加上一个大括号:String.Format("{0} wo{rld!","hello") //就会产生一个异常,异常信息是:Input string was not in a correct format.//解决办法:String.Format("{0} wo{{rld!","hello")//orString.Format( 阅读全文
posted @ 2013-12-18 11:48 Shikyoh 阅读(3157) 评论(0) 推荐(1) 编辑
摘要:后端:页面需继承ICallbackEventHandler protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strRefrence = string.Empty; strRefrence = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveDataFromServer", "conte... 阅读全文
posted @ 2013-12-18 10:57 Shikyoh 阅读(355) 评论(0) 推荐(0) 编辑
摘要:我写的服务器控件(未完,模型如此)using System;using System.Collections.Generic;using System.Collections.Specialized;using System.ComponentModel;using System.Linq;using System.Resources;using System.Text;using System.Threading.Tasks;using System.Web;using System.Web.UI;using System.Web.UI.HtmlControls;using System.W 阅读全文
posted @ 2013-12-17 17:21 Shikyoh 阅读(836) 评论(0) 推荐(0) 编辑
摘要:(function () { alert("222"); })();JS匿名方法。DecColorPicker.Properties.Resources.colorPicker);引用Dll中资源。(通过属性资源添加) 阅读全文
posted @ 2013-12-17 11:59 Shikyoh 阅读(156) 评论(0) 推荐(0) 编辑
摘要:public IEnumerable Search(string keyword, string[] fieldNames, int pageSize, int pageIndex) { if (fieldNames.Length == 0) { return null; } // 计算开始的索引 int start = pageSize * (pageIndex - 1); // 需要的记录数 ... 阅读全文
posted @ 2013-12-16 18:08 Shikyoh 阅读(327) 评论(0) 推荐(0) 编辑
摘要:1.执行 标准的创建aspnetdb的脚本。2.最关键的2,最最关键的2.必须给aspnet_SchemaVersions表初始化数据,不然会报数据库架构版本不兼容的错误。/*Insert aspnet_SchemaVersions*/INSERT INTO [dbo].[aspnet_SchemaVersions] ([Feature] ,[CompatibleSchemaVersion] ,[IsCurrentVersion]) VALUES ('common','1',1)INSERT INTO [db... 阅读全文
posted @ 2013-04-18 15:49 Shikyoh 阅读(242) 评论(0) 推荐(0) 编辑
摘要:安装完 vs 2012 后 连接数据库报 已成功与服务器建立连接,但是在登录前的握手期间发生错误。 (provider: SSL Provider, error: 0 - 等待的操作过时。)很郁闷,其他电脑都好好的,为什么我的不行。检查网络Lsp发现,之前装的一些网络加速器搞的怪,修复后,连接正常。 阅读全文
posted @ 2013-02-21 16:37 Shikyoh 阅读(995) 评论(1) 推荐(1) 编辑
摘要:private void AutoRefresh() { WebBrowser webBrowser = new WebBrowser(); webBrowser.Navigated += new WebBrowserNavigatedEventHandler(webBrowser_DocumentCompleted); while (1 == 1) { if (HasRun) { Loadf... 阅读全文
posted @ 2013-01-15 15:17 Shikyoh 阅读(384) 评论(0) 推荐(0) 编辑
摘要:今天写程序的时候调用到一个第三方的DLL文件,本机调试一切都正常,但是程序不是到服务器以后一直提示一个BUG:"基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系"。 后来把DLL文件进行反编译,发现是在获得请求的时候出错了。 引用WebResponse response = WebRequest.Create("https://……").GetResponse(); 于是在服务器上用浏览器打开上面的地址,发现会弹出一个确认证书的窗口,看来是证书问题。 在网上一顿搜索,发现了一个决绝办法甚是好用,而且很简单,在请求之前添加一行代码。 C#代码 阅读全文
posted @ 2013-01-14 18:12 Shikyoh 阅读(4396) 评论(1) 推荐(1) 编辑
摘要:同一个Dll在不同的Reflector版本中,反编译的代码会有细微的差别,但这个细微的差别恰好是致命的。Lutz Roeder 版本的 阅读全文
posted @ 2012-08-29 10:52 Shikyoh 阅读(237) 评论(1) 推荐(0) 编辑
摘要:将一个Json字符串转化为其他对象 实现方法 static void Main(string[] args) { var temp = "{StartDegree:398.00,EndDegree:407.00,Dosage:270.00}"; JavaScriptSerializer jv = new JavaScriptSerializer(); var dict = jv.Deserialize<Dictionary<string, object>>(temp); }需注意... 阅读全文
posted @ 2012-06-19 11:22 Shikyoh 阅读(230) 评论(0) 推荐(0) 编辑
摘要:先记录稍后整理exec sp_lock 快捷键 C_2exec sp_who active exec sp_who快捷键 C_1用Profiler里面的Locks->Deadlock graph 监控看看,如果看到了死锁图,就可以比较形象地展现死锁发生的过程,还可以看到锁的具体类型和过程里面的语句,对你诊断会有帮助。Declare @LockTab table( spid int,dbid int ,ObjId int,IndId int ,Type varchar(50),Resource varchar(50),Mode varchar(50),Status varchar(50)) 阅读全文
posted @ 2012-04-18 14:41 Shikyoh 阅读(1762) 评论(0) 推荐(1) 编辑
摘要:主要是为了应付不同类之间成员的相互赋值。节省代码量。namespace ConsoleApplication3{ public interface interTest { } public class Test : interTest { public string Name; public int Id; public int TestId; public int Property { get; set; } } public class TestClone { public... 阅读全文
posted @ 2012-04-11 16:58 Shikyoh 阅读(668) 评论(1) 推荐(0) 编辑
摘要:namespace ConsoleApplication2{ public abstract class Animal { public string GetRootName() { return "动物"; } public abstract string GetName(); } public class Monkey : Animal { public override string GetName() { return "猴子";... 阅读全文
posted @ 2012-04-10 16:42 Shikyoh 阅读(260) 评论(0) 推荐(0) 编辑