ASP.NETÒ³Ãæ´«Öµ_µÚËÄƪ_Session
ÀýÒ»£º
+++ ÐÞ¸ÄGlobal.asaxÎļþ£º
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{ }
void Application_End(object sender, EventArgs e)
{ }
void Application_Error(object sender, EventArgs e)
{ }
void Session_Start(object sender, EventArgs e)
{
Session["GlobalString"] = "TEST GLOBAL!!!";
}
void Session_End(object sender, EventArgs e)
{ }
</script>
+++ SeesionShare01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
TextBox3.Text = Session["GlobalString"].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["name"] = TextBox1.Text.Trim().ToString();
Session["email"] = TextBox2.Text.Trim().ToString();
Server.Transfer("SeesionShare02.aspx");
}
+++ SeesionShare02.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
if (Session["name"] != null && Session["email"] != null)
{
Response.Write("ÐÕÃû£º" + Session["name"].ToString() + "</br>" +
"µç×ÓÓʼþ£º" + Session["email"].ToString());
Session.Clear();
//Session.Remove("name");
//Session.Remove("email");
}
}
Àý¶þ£º
+++ PassDataTableBySession01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="ÓÃSession´«Êý¾Ý¼¯" />
++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
string connStr =
Ïà¹ØÎĵµ£º
1.Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= a ......
asp.netÖе¼³öExeclµÄ·½·¨£º
ÔÚasp.netÖе¼³öExeclÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊǽ«µ¼³öµÄÎļþ´æ·ÅÔÚ·þÎñÆ÷ij¸öÎļþ¼ÐÏÂÃ棬Ȼºó½«ÎļþµØÖ·Êä³öÔÚä¯ÀÀÆ÷ÉÏ£»Ò»ÖÖÊǽ«ÎļþÖ±½Ó½«ÎļþÊä³öÁ÷д¸øä¯ÀÀÆ÷¡£ÔÚResponseÊä³öʱ£¬t·Ö¸ôµÄÊý¾Ý£¬µ¼³öexeclʱ£¬µÈ¼ÛÓÚ·ÖÁУ¬nµÈ¼ÛÓÚ»»ÐС£
1¡¢½«Õû¸öhtmlÈ«²¿Êä³öexecl
´Ë·¨½«htmlÖÐËùÓеÄÄÚÈÝ£ ......
Ò»£¬Ç°ÑÔ
CookiesÏë±ØËùÓÐÈ˶¼Á˽⣬ µ«ÊÇδ±ØËùÓÐÈ˶¼¾«Í¨¡£±¾ÎĽ²½âÁËCookiesµÄ¸÷·½Ãæ֪ʶ£¬ ²¢ÇÒÌá³öÀ´ÁË×î¼Ñʵ¼ù¡£ÕâÊDZÊÕßÔÚÈÕ³£¹¤×÷ÖеĻýÀۺͳÁµí¡£
¶þ£¬»ù´¡ÖªÊ¶
1.ʲôÊÇCookies
Cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæ×ÅÓû§ÇëÇóºÍÒ³ÃæÔÚ Web ·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Cookie °üº¬Ã¿´ÎÓû§·ÃÎÊÕ¾µãʱ Web Ó¦ÓóÌÐò¶¼¿ ......
/// <summary>
/// ¸ù¾ÝÖ¸¶¨²ÎÊý·µ»ØBitMap¶ÔÏó
/// ÒýÓÃÈçÏ£º
/// using System.Drawing;
/// µ÷ÓÃÀý×ÓÈçÏ£º
......
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
+++ ºǫ́´úÂëÈçÏ£º
protected void Butto ......