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 =
Ïà¹ØÎĵµ£º
Ê×Ïȼòµ¥½éÉÜһϠWCF ÊÇʲô£¬È»ºóÔÙ¶Ô WCF ºÍ Asp.net Web service ×ö¸ö±È½Ï¡£
Windows Communication Foundation (WCF) ÊÇÓÃÓÚ¹¹½¨ÃæÏò·þÎñµÄÓ¦ÓóÌÐòµÄ¿ò¼Ü¡£½èÖú WCF£¬¿ÉÒÔ½«Êý¾Ý×÷ΪÒì²½ÏûÏ¢´ÓÒ»¸ö·þÎñÖÕ½áµã·¢ËÍÖÁÁíÒ»¸ö·þÎñÖÕ½áµã¡£·þÎñÖÕ½áµã¿ÉÒÔÊÇÓÉ IIS ³ÐÔصijÖÐø¿ÉÓõķþÎñµÄÒ»²¿·Ö£¬Ò²¿É ......
asp.netÖе¼³öExeclµÄ·½·¨£º
ÔÚasp.netÖе¼³öExeclÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊǽ«µ¼³öµÄÎļþ´æ·ÅÔÚ·þÎñÆ÷ij¸öÎļþ¼ÐÏÂÃ棬Ȼºó½«ÎļþµØÖ·Êä³öÔÚä¯ÀÀÆ÷ÉÏ£»Ò»ÖÖÊǽ«ÎļþÖ±½Ó½«ÎļþÊä³öÁ÷д¸øä¯ÀÀÆ÷¡£ÔÚResponseÊä³öʱ£¬t·Ö¸ôµÄÊý¾Ý£¬µ¼³öexeclʱ£¬µÈ¼ÛÓÚ·ÖÁУ¬nµÈ¼ÛÓÚ»»ÐС£
1¡¢½«Õû¸öhtmlÈ«²¿Êä³öexecl
´Ë·¨½«htmlÖÐËùÓеÄÄÚÈÝ£ ......
Ò»£¬Ç°ÑÔ
CookiesÏë±ØËùÓÐÈ˶¼Á˽⣬ µ«ÊÇδ±ØËùÓÐÈ˶¼¾«Í¨¡£±¾ÎĽ²½âÁËCookiesµÄ¸÷·½Ãæ֪ʶ£¬ ²¢ÇÒÌá³öÀ´ÁË×î¼Ñʵ¼ù¡£ÕâÊDZÊÕßÔÚÈÕ³£¹¤×÷ÖеĻýÀۺͳÁµí¡£
¶þ£¬»ù´¡ÖªÊ¶
1.ʲôÊÇCookies
Cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæ×ÅÓû§ÇëÇóºÍÒ³ÃæÔÚ Web ·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Cookie °üº¬Ã¿´ÎÓû§·ÃÎÊÕ¾µãʱ Web Ó¦ÓóÌÐò¶¼¿ ......
ÕâÁ½Ìì¿´¡¶µÀ²»Ô¶ÈË-----ÉîÈë½âÎöASP.NET2.0¿Ø¼þ¿ª·¢¡·Õâ±¾Ê飬¿´ÍêµÚ¶þÕÂÄÚÈݺó£¬Ïë×ܽáÏ“ÉèÖÃ×Ô¶¨ÒåASP.NET·þÎñÆ÷¿Ø¼þTagPrefixµÄ¼¸ÖÖ·½·¨”£¬ÒÔ±ãÒÔºó²éÔÄ£¬ÒÔÏÂÃæcode±àдµÄ¿Ø¼þΪÀý£¬ÓÉÓÚÖص㲻Êǿؼþ±àд£¬ËùÒÔдÁ˸ö·Ç³£¼òµ¥µÄ¿Ø¼þ£¬¹ÃÇÒ½ÐËüEmailInput
Code
1using System;
2using ......
HttpContext.Current.Request.Url.ToString() ²¢²»¿É¿¿¡£
Èç¹ûµ±Ç°URLΪ
http://localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5
ͨ¹ýHttpContext.Current.Request.Url.ToString()»ñÈ¡µ½µÄÈ´ÊÇ
http://localhost/search.aspxuser=http://csharp.xdowns.com&tag=¼&fra ......