摘要: asp.net 文件流 文件下载 #region 文件下载 public void downloadfile(int id) { try { chr_Action_Apply apply = db.chr_Action_Apply.Find(id); string s_fileName = Request["FileName"];//文件名 Response.ContentType = "application/ms-d... 阅读全文
posted @ 2012-02-09 11:25 wongley 阅读(235) 评论(0) 推荐(0) 编辑
摘要: View Code #region 判断是否是IP地址格式 /// <summary> /// 判断是否是IP地址格式 0.0.0.0 /// </summary> /// <param name="str1">待判断的IP地址</param> /// <returns>true or false</returns> public static bool IsIPAddress(string str1) { if (string.IsNullOrEmpty(s... 阅读全文
posted @ 2012-02-09 11:02 wongley 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 获取IP地址 #region 获取IP地址 public string getIP() { string result = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(result)) { //可能有代理 if (result.IndexOf(".") == -1) //没... 阅读全文
posted @ 2012-02-09 10:45 wongley 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 根据原图片生成等比缩略图#region 根据原图片生成等比缩略图 /// <summary> /// 根据源图片生成缩略图 /// </summary> /// <param name="imgPath_old">源图(大图)物理路径</param> /// <param name="imgPath_new">缩略图物理路径(生成的缩略图将保存到该物理位置)</param> /// <param name="width">缩略图宽度</param 阅读全文
posted @ 2012-02-09 10:40 wongley 阅读(778) 评论(0) 推荐(0) 编辑
摘要: asp.net 图片水印和文字水印 //type传入参数类型是图片水印还是文字水印 public void addStrToImage(string type) { string path = System.Web.HttpContext.Current.Server.MapPath("/Images/") + "WarterImage.jpg"; System.Drawing.Image image = System.Drawing.Image.FromFile(path); if (type ==... 阅读全文
posted @ 2012-02-09 10:30 wongley 阅读(629) 评论(0) 推荐(0) 编辑