易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET学习经验收集(不断更新)

       在日常学习和使用ASP.NET的过程中,有些比较特殊有用的经验收集在这里,方便自己记忆和理解,也希望能帮助到一些初学者参考。如果有些不足的地方希望高手不吝赐教!!!
一、在一般处理文件(ashx)中使用Session时,需要引进命名空间:using System.Web.SessionState; 并且使该类实现IRequiresSessionState接口,然后就能通过HttpContext.Current.Session使用Session了!   
       
简易代码如下:
          
using System.Web.SessionState;
........
public class Handler : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
       
         HttpContext.Current.Session["user"] = "luoyisheng";         
       
      }
 
    public bool IsReusable
    {
         get
         {
             return false;
         }
     }
}


相关文档:

asp.net(C#)实现SQL2000数据库备份和还原

asp.net(C#)实现SQL2000数据库备份和还原
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......

Asp.net(C#)多文件上传


FileUp.aspx 页面
 1<%@ Page language="c#" Codebehind="FileUp.aspx.cs" AutoEventWireup="false" Inherits="TestCenter.FileUp" %>
 2<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 3<HTML>
 4  <HEAD>
 5    &l ......

asp.net 图片处理 获取图片宽度和高度

1.获取图片宽度和高度
    1.您可以使用 System.Drawing.Image 类
    System.Drawing.Image img = System.Drawing.Image.fromFile(Server.MapPath("example.gif"));
int width = img.Width;
int height = img.Height;
img.Dispose();
但是这里我们却不能在导入名称空间后使用 Image& ......

asp.net 图片 画线

Bitmap srcImg = new Bitmap(300, 300); //也可以读入一张图片
Graphics graphics = Graphics.fromImage(srcImg);
Font font = new Font("宋体", 16); //字体与大小
Brush brush = new SolidBrush(Color.Red);
graphics.DrawString("www.cftea.com", font, brush, 50, 50); //写字,最后两个参数表示位置
Pen pen = ne ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号