Asp.netÒ³ÃæÖ®¼ä´«µÝ²ÎÊý·½·¨
µÚÒ»ÖÖ·½·¨£º
ͨ¹ýURLÁ´½ÓµØÖ·´«µÝ
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
Request.Redirect("Default2.aspx?username=honge");
}
receive.aspx:
string username = Request.QueryString["username"]; // ÕâÑù¿ÉÒԵõ½²ÎÊýÖµ¡£
µÚ¶þÖÖ·½·¨£º
ͨ¹ýpost·½Ê½¡£
send.aspx
<form id="form1" runat="server" action="receive.aspx" method=post>
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:TextBox ID="username" runat="server"></asp:TextBox>
</div>
</form>
receive.aspx
string username = Ruquest.Form["receive"]; // ÕâÑù¿ÉÒԵõ½²ÎÊýÖµ¡£
µÚÈýÖÖ·½·¨£º
ͨ¹ýsession
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
Session["username"] = "honge";
Request.Redirect("Default2.aspx");
}
receive.aspx:
string username = Session["username"]; // ÕâÑù¿ÉÒԵõ½²ÎÊýÖµ¡£
µÚËÄÖÖ·½·¨£º
ͨ¹ýApplication
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
Application["username"] = "honge";
Request.Redirect("Default2.aspx");
}­
Ïà¹ØÎĵµ£º
Ïã¸ÛÄDZ߹«Ë¾µÄÊг¡²¿¿ª»áʱҪÇóÎÒÃÇÕâ±ßʵÏÖÒ»¸ö¶¨Ê±·¢ËÍÓʼþµÄ¹¦ÄÜ£¬¼´ÔÚÿÌìÏÂÎç5µã×óÓÒ¶¨Ê±°Ñ½ñÌìÒÑͨ¹ýÈýÉóµÄ¶©µ¥ÐÅÏ¢·¢¸øÊг¡²¿µÄ¾Àí£¬¸æËßËûÄÄЩ¶©µ¥ÒѾͨ¹ýÁËÖÕÉó¡£Æ½Ê±Ö»ÖªµÀÈçºÎÓÃ.net·¢ËÍÓʼþ£¬µ«²»ÖªÈçºÎ¶¨Ê±·¢ËÍÓʼþ¡£ÓÚÊÇ°Ù¶ÈÁËһϣ¬×ܽáÆðÀ´ÓÐÒÔÏÂÄÇôÈýÖÖ£º
£¨1£©×öÒ»¸öwinform À´¶¨Ê±·¢Óʼþ¡£È»ºóͨ¹ý ......
ÓÐʱºòÐèÒª¶¯Ì¬µÄÉèÖà WebService µÄÖ·£¬ÕâÑù·¢²¼µ½²»Í¬µÄ·þÎñÆ÷ʱ¾ÍÒªÖØÐÂÉú³É£¬Îª´ËÎÒÃÇÐèÒªÔÚweb.configÖж¯Ì¬ÅäÖÃWebServiceµÄµØÖ·£¬ÔÚÍøÉϲéÁ˺ܶà×ÊÁÏ£¬ÆäÖÐÕâÖÖ·½·¨¸Ð¾õºÜºÃÓÃÒ²ºÜºÃʵÏÖ£¬ÔÎÄVB.NETʵÏÖ¡£±¾ÈËÒѸÄΪC#°æ
¡¡¡¡Ê×ÏÈÊÖ¶¯µÄÌí¼ÓÒ»¸öWebÒýÓã¨Õâ¸ö¾Í²»ÓÃ˵ÁË°É£©
¡¡¡¡È»ºóÐ޸ı¾µØµÄ´úÀíÀࣨÌí¼ÓÒ»¸öÐ ......
1£º¿Í»§¶Ë
<table border="0" style="width: 60%">
¡¡¡¡<tr><td colspan="2" style="height: 5px">
Êý¾Ý¿â»¹ÔºÍ±¸·Ý:</td></tr>
¡¡¡¡<tr><td style="width: 171px; height: 23px;">
ÇëÑ¡ÔñÊý¾Ý¿â:</t ......
Ò»£¬»ñµÃMircosoft URLRewriter.dll£º
»ñµÃMircosoft URLRewriter.dll¿ÉÒÔµ½http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx?mfr=true
ÏÂÔØÍê±Ïºó£¬µ¼È빤³Ì£¬ÎÒÕâÀïûÓжԸù¤³Ì×öÈκÎÐ޸ģ¬±£ÁôÁËÔÀ´µÄÖØд·½Ê½£¬È»ºóÖ±½ÓÔÚVS2005ÀïÃæÉú³É.dllÎļþ¾Í¿ÉÒÔÁË¡£
¶þ£¬Ê¹ÓøÃdl ......
//µÚÒ»ÖÖ·½Ê½
Response.Cookie("CookieÃû³Æ").value="Öµ" //дÈë
username=Request.Cookies("CookieÃû³Æ").value// ¶ÁÈ¡
//µÚ¶þÖÖ·½Ê½
HttpCookie hcCookic = new HttpCookie("CookieÃû³Æ","Öµ");
Response.Cookies.Add(hcCoo ......