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数据库备份和还原
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.NET2.0中,为我们提供了两种新功能,方便我们制作共同特征一致的页面和导航。这两种功能是母板页和网站导航。对于母板页大家很清楚了,不过在做母板页时,经常需要添加导航栏,对于此asp.net 2.0 使我们的工作大为简化。这便是站点地图的使用。
顾名思义,站点地图就是在站点 ......
System.Drawing.Image watermark = System.Drawing.Image.fromFile(Server.MapPath("watermark.gif"));
Bitmap srcImg = new Bitmap(Server.MapPath("example.jpg"));
Graphics graphics = Graphics.fromImage(srcImg);
graphics.DrawImage(watermark,
srcImg.Width - watermark.Width,
srcImg.Height - w ......
<HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>
<META http-equiv=Content-Type c>
<SCRIPT language=JScript event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
var MACaddress=unescape(MACAddr);
alert(MACaddress);
document.forms[0].txtMACAddr.value=u ......
1.//弹出对话框.点击转向指定页面
Response.Write("<script>window.alert('该会员没有提交申请,请重新提交!')</script>");
Response.Write("<script>window.location ='http://www.cgy.cn/bizpulic/upmeb.aspx'</script>");
2.//弹出对话框
Response.Write("<scr ......