• [.NET] 生成缩略图多种方法。 日期:2016/12/9 15:16:00点击:2268来源:互联网

    public static void MakeThumbnail(string ImagePath, int w, int h, string SavePath = "", ThumbnailMode mode = ThumbnailMode.HW) { Image originalImage = Image.FromFile(files.MapPath(ImagePath)); int towidth = w; int toheight = h; int x = 0; int y = 0; int ow = originalImage.Width; int oh = originalImage.Height; switch (mode) { case ThumbnailMode.HW://指定高宽缩放(可能变形) break; case Thum...

  • [.NET] .NET MVC中使用 EF 增删改查 示例 日期:2016/11/16 16:58:00点击:2182来源:互联网

    //这个是分页数据和总页数类public class SummaryBase<TModel> { public SummaryBase();public IList<TModel> Collection { get; set; } public int TotalCount { get; set; } }//查询学校数据分页 BM.Criteria.SchoolDataCriteria 这个是条件类,根据自己的需求定义public static SummaryBase<EF.SchoolData> QuerySchoolData(BM.Criteria.SchoolDataCriteria schoolDataCriteria) { string cityCode = schoolD...

  • [.NET] ajax 提交 日期:2016/10/14 14:45:00点击:2151来源:互联网

    前端部分: $.ajax({ type: 'post', url: 'ajax/flyso.aspx?action=do', data: $(".flysoForm").serialize(), success: function (data) { if (data == 1) { succ("留言成功!"); $(".lxform")[0].reset(); } else if (data == 3) warn("一小时内只允许提交3次!"); else alert("留言失败!"); } });后端部分:Hashtable ht = Requests.GetAllValues();ht["ip...

  • [.NET] 网易云信短信接口发送代码 日期:2016/9/26 15:22:00点击:2434来源:互联网

    public class YunSms { public static bool Send(string mobile, string content = "", int templateid = 8467) { bool r = false; string AppKey = "xxx"; string AppSecret = "xxx"; string t1 = Dates.timeStamp().ToString(); string Nonce = Fun.GetShortNo; string cs = Security.Sha1(AppSecret + Nonce + t1); Hashtable ht = new Hashtable(); ht["AppKey"] = AppKey; ht["...

  • [.NET] .NET (C#) 防止外部提交数据 日期:2016/8/10 14:28:00点击:2279来源:互联网

    防止站外提交数据,就是防止从非本网站外部提交数据到本网站,也就是如果发送数据的页面不是本站的页面,则禁止接收数据。第一种方法是在代码顶部加上EnableViewStateMac="true"来防止从网站外提交数据,比如:<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="common.aspx.cs"Inherits="manage_common"EnableViewStateMac="true"%>这种方法基本就解决问题了。...

  • [.NET] ASPX页面的缓存OutputCache 日期:2016/4/12 12:21:00点击:2567来源:互联网

    使用@OutputCache指令,能够实现对页面输出缓存。使用OutputCache指令两个必要属性1.Duration表示缓存的时间,单位为秒。2.VaryByParam不使用缓存的参数,其值为用分号分隔的字符串列表。<%@OutputCacheDuration="60"VaryByParam="none"%>页面不管参数如何变化,都会使用缓存中的内容,在1分钟内。<%@OutputCacheDuration="60"VaryByParam="*"%>页面只要有参数有变化,就不使用缓存中...

  • [.NET] 判断访问来源是否来自手机 日期:2015/12/3 17:33:00点击:3067来源:互联网

    publicBooleanIsMobileDevice(){string[]mobileAgents={"iphone","android","phone","mobile","wap","netfront","java","operamobi","operamini","ucweb","windowsce","symbian","series","webos","sony","blackberry","dopod","nokia",...

  • [.NET] 关于ToShortDateString()方法在不同操作系统中的输出 日期:2015/12/3 17:33:00点击:2631来源:互联网

    在注册表中搜索“yyyy/”搜索到的都改为你想要的格式“yyyy-MM-dd” 或 “yyyy-M-d”。修改完,重启一下IIS就能看到效果 仅供参考:(系统Win2008)位置:HKEY_USERS\\.DEFAULT\\ControlPanel\\International键值名:sShortDate位置:HKEY_USERS\\S-1-5-19\\ControlPanel\\International键值名:sShortDate位置:HKEY_USERS\\S-1-5-20\\ControlPanel\\International键值名:sShortDate

  • [.NET] 微信公众平台 上传多媒体文件,返回 MediaId 日期:2015/12/3 17:32:00点击:1925来源:互联网

    /// <summary> /// 上传多媒体文件,返回 MediaId /// </summary> /// <param name="ACCESS_TOKEN"></param> /// <param name="Type"></param> /// <returns></returns> public string UploadMultimedia(string ACCESS_TOKEN, string Type) { string result = ""; string wxurl = "http://file.api.weixin.qq.com/cgi-bin/media/upload?acce...

  • [.NET] Win2008(X64) IIS7.5 XinYuee.UrlRewriter URL重写 日期:2015/12/3 17:32:00点击:1855来源:互联网

    <system.webServer> <handlers> <remove name="SSINC-shtml" /> <add name="shtml_X64" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersio...

  • [.NET] 一个Windows后台服务(.Net的C#版) - 定时访问数据库 日期:2015/12/3 17:30:00点击:2162来源:互联网

    所谓Windows后台服务,即后台自动运行的程序,一般随操作系统启动而启动,在我的电脑 服务后应用程序 服务里面能看到当前电脑的服务.一般而言,程序上用VC、C++写Windows服务,但是我对这些语言不是很熟,一般编程用C#较多,所以就用C#语言写了一个Windows服务.其实需求是这样的,做那个报价系统的时候加入了发短信的功能,订单处理完即将发货的时候要发送短信都客户手机上,公司内部员工处理订单超时要自动发短信,群发产品促销信息到客户手...

  • [.NET] Response.Flush 用法 日期:2015/12/3 17:29:00点击:1757来源:互联网

    Response.Write的字节必须大于256 private void Write(string content) { content = content.Length <= 256 ? content.PadRight(300 - content.Length,'F') : content; Response.Write(content + "\r\n"); Response.Flush(); Response.Clear(); }

  • [.NET] 给aspx页加缓存 日期:2015/12/3 17:28:00点击:1279来源:互联网

    <%@ OutputCacheDuration="3600" Location="ServerAndClient" VaryByParam="none" %>

  • [.NET] VS2010 解决方案转换成 VS2008 日期:2015/12/3 17:28:00点击:1621来源:互联网

    原文链接地址:http://www.codeproject.com/Tips/80953/Converting-VS2010-Solution-to-VS2008如果你使用VS2010的任何版本写代码,那么在VS2008中就不能打开VS2010的解决方案了,为此,通过以下三步就可以解决了 一.对于工程名.sln; 1.用你喜欢的编辑器打开sln文件,比如notepad++ 2.找到下面的字符串Microsoft Visual Studio Solution File, Format Version 11.00. # Visual Studio 2010.并且用下面的字串替换Microsoft Visual Studio...

  • [.NET] 几个很强大的正则表达式 日期:2015/12/3 17:28:00点击:1750来源:互联网

    将html内容中特定的内容放到集中并列出来var list = Regex.Matches(str, @"(?is)ST_+(?=[^>]*?pid\-(?<pid>[^&_]+))(?=[^>]*?sid\-(?<sid>[^&_]+))(?=[^>]*?innername\-(?<innername>[^&]+))(?=[^>]*?format\-(?<format>[^&_]+)).*?_+ST").OfType<Match>().Select(t => new { pid = t.Groups["pid"].Value, sid = t.Groups["sid"].V...

  • [.NET] C# 正则表达式 实现 将特定内容 放到集合中 日期:2015/12/3 17:27:00点击:1422来源:互联网

    var list = Regex.Matches(str, @"(?is)<ST:(?=[^>]*?id=([""'])(?<id>[^""']+)\1)(?=[^>]*?tooltip=([""'])(?<tooltip>[^""']+)\2)[^>]*>").OfType<Match>().Select(t => new { id = t.Groups["id"].Value, tooltip = t.Groups["tooltip"].Value }).ToList();

  • [.NET] 给.NET 按钮 Button 点击后,加上动态文字并禁用 日期:2015/12/3 17:25:00点击:1527来源:互联网

    this.Button1.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(Button1, "Click") + ";this.Disabled=true; this.value='提交中...';");

  • [.NET] C#操作Url参数类 日期:2015/12/3 17:24:00点击:1397来源:互联网

    //url里有key的值,就替换为value,没有的话就追加. public static string UrlParam(string url, string ParamText, string ParamValue) { Regex reg = new Regex(string.Format("{0}=[^&]*",ParamText),RegexOptions.IgnoreCase); Regex reg1 = new Regex("[&]{2,}", RegexOptions.IgnoreCase); string _url = reg.Replace(url, ""); //_url = reg1.Replace(_url, ""); if (_url....

  • [.NET] TreeView的CheckBox进行选中插入数据库,从数据库中 日期:2015/12/3 17:23:00点击:1338来源:互联网

    #region 绑定角色/// <summary> /// 绑定权限信息/// </summary> protected void BindgvRoles() { string sql = "select * from GM_FileKind"; DataTable dt = OADBHelper.GetDataTable(sql); this.gvRoles.DataSource = dt; this.DataBind(); } #endregion #region TreeView 表员工表的显示至TreeView控件/// <summary> /// Tree绑定/// </summary> public void BindTree() { this.tvUsers.No...

  • [.NET] 通过字符串获取Color类 日期:2015/12/3 17:22:00点击:1219来源:互联网

    public static Color getColor(string s) { Color Colors; if (s.IndexOf("#") >= 0) { Colors = ColorTranslator.FromHtml(s); } else { Colors = Color.FromName(s); } return Colors; }

Copyright © 2005 - 2016 flyso.cn. 飞搜 版权所有 鄂ICP备11002783号-3