Asp.Net C#ÖÐSession ÈçºÎ´¢´æÈ¡ÐÅÏ¢
ÒòΪ¸Õ¸Õ½Ó´¥C#ÓïÑÔ²»¾Ã,ÓÚÊÇÎÒ°Ñ¿ØÖÆÌ¨¸øÈÓÁË,ÒòΪÎÒÌÖÑá¿ØÖÆÌ¨!
¶øÊÂʵÉÏÎÒÖ»¶ÔWinForm¼¼Êõ¸ÐÐËȤ,µ«ÊÂʵÉϵ½ÏÖÔÚÎÒ·¢ÏÖASP.Net C#µÄWeb¼¼ÊõÊÇÈÕÏÔÖØÒªÆðÀ´!
ÓÚÊÇ¿ªÊ¼½Ó´¥,¸Õ¸ÕÆð²½ÓÚËùÖª,ÓÈÆäÊÇһЩ×î¼òµ¥µÄ¶«Î÷,µ½ÍøÉÏËÑË÷Á˺ܾÃ,²»ÊÇÌ«ÂÒ¾ÍÊÇ˵²»Çå³þ!
¾Ù¸öÀý×ÓÀ´Ëµ,¾Í˵SessionºÃÁË,²»ÖªµÀÍøÉϵÄÄÇЩ¼Ò»ïµ½µ×ÔÚ½²Ê²Ã´?
»òÐíÊÇÎÒÌ«±¿°É!ÕæÊÇÎÞ·¨Àí½âËûÃǵĶ«¶«!
ÓÚÊÇÎÒ»¹ÊǾö¶¨×Ô¼ºÑо¿Ò»ÏÂ,½ñÌìÏÂÎ绨ÁËÒ»µãʱ¼ä,Êܵ½³É¹ûÈçÏÂ:
(1)Load.aspx.csÎļþÖÐ:
public class MYuser
{
public MYuser()
{
}
private string name;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
}
//×¢ÒâMYuserÕâ¸öÀà´úÂëµÇ½µÄÓû§¶ÔÏóµÄÀà
//ÎÒ°ÑËüдÔÚÁËLoad.aspx.csÎļþÖÐ:µ«²»ÊÇLoadÀàÖÐ,¶øÖ»ÊÇͬһÃüÃû¿Õ¼ä
(2)Load.aspx.csÎļþÖÐ:
protected void Button1_Click(object sender, EventArgs e)
{
try{
&n
Ïà¹ØÎĵµ£º
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
names ......
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
}
}
/// <summary>
/// ·µ»Ø°´Å¥µã»÷ʼþ
/// </summary& ......
Ò»¡¢SqlDataReadºÍDatasetµÄÑ¡Ôñ
SqldatareadÓŵ㣺¶ÁÈ¡Êý¾Ý·Ç³£¿ì¡£Èç¹û¶Ô·µ»ØµÄÊý¾Ý²»Ðè×ö´óÁ¿´¦ÀíµÄÇé¿öÏ£¬½¨ÒéʹÓÃSqlDataReader£¬ÆäÐÔÄÜÒª±ÈdatsetºÃºÜ¶à¡£È±µã£ºÖ±µ½Êý¾Ý¶ÁÍê²Å¿ÉcloseµôÓÚÊý¾Ý¿âµÄÁ¬½Ó
(SqlDataReader ¶ÁÊý¾ÝÊÇ¿ìËÙÏòǰµÄ¡£SqlDataReader ÀàÌṩÁËÒ»ÖÖ¶ÁÈ¡´Ó SQL Server
Êý¾Ý¿â¼ìË÷µÄÖ»½øÊý¾ÝÁ÷µ ......
“<%#....%>” ÕâÊÇÊý¾Ý°ó¶¨£¬ÀïÃæ¿ÉÒÔµ÷ÓÃC#µÄ·½·¨¡£
“<%$....%>" û¼û¹ýÕâ¸ö¡£
“<%@...%>”Õâ¸öÊÇÒ³ÃæÖ¸Áһ°ã·ÅÔÚÿ¸öÒ³ÃæµÄ×î¶¥²¿£¬¶ÔÒ³ÃæµÄÔËÐнøÐпØÖÆ£¬ÈçÉèÖûº´æ£¬ÒýÓÃÓû§¿Ø¼þ£¬µ¼ÈëÃüÃû¿Õ¼ä==
ÁíÍ⻹ÓÐÒ»¸ö<%= ...%> Õâ¸ö=ºÅºóÒ²¿ÉÒÔµ÷ÓÃC#µÄ·½· ......
·¢ËͶËÒÔ163ΪÀý
Ò»¡¢asp.net°æ using System.Web.Mail; //ÃüÃû¿Õ¼äÒýÓÃ
c#
MailMessage mail = new MailMessage();
mail.To = "shadow103@qq.com"; //½ÓÊÜÈ˵ÄÓÊÏä
& ......