Asp.netÒ³Ãæ´«ÖµµÄ¼¸ÖÖ·½Ê½
Ò»¡¢Ê¹ÓÃQueryString²ÎÊý
QueryString½«´«µÝµÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖУ¬ÊÇÒ»Öַdz£¼òµ¥Ò²Ê¹ÓñȽ϶àµÄ´«Öµ·½Ê½¡£
Èç¹û´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨
/// <summary>
/// ʹÓÃQueryString±äÁ¿
/// </summary>
/// <param name="param1"></param>
/// <param name="param2"></param>
//sourcePage
Response.Redirect("target.aspx?param1 = hello¶m2 = hi");
//targetPage
string str1 = Request.QueryString["param1"];
string str2 = Request.QueryString["param2"];
¶þ¡¢Ê¹ÓÃcookie¶ÔÏó±äÁ¿
cookie´æ·ÅÔÚ¿Í»§¶ËÖÐ
//setting cookie
HttpCookie cookie_name = new HttpCookie("name");
cookie_name.value = txtName.Text.Trim();
Response.AppendCookie (cookie_name);
//get cookie
string name = Request.Cookie["name"].Value.ToString();
Èý¡¢Ê¹ÓÃsession±äÁ¿
session´æ·ÅÔÚ·þÎñÆ÷ÖУ¬Èç¹ûÁ¬½Ó³¬Ê±µÈÇé¿ö£¬ÓпÉÄܻᷢÉúÊý¾Ý¶ªÊ§
//setting session
Session["name"] = "hello";
//get session
string name = Session["name"].ToString();
ËÄ¡¢Ê¹ÓÃApplication±äÁ¿
Application±äÁ¿µÄ×÷Ó÷¶Î§ÊÇÕû¸öÈ«¾Ö£¬Ò²¾ÍÊÇ˵¶ÔËùÓеÄÓû§¶¼ÓÐЧ£¬Òò´Ë´ËÖÖ·½·¨²»³£Óá£
ÒòΪApplicationÔÚÒ»¸öÓ¦ÓóÌÐòÓò·¶Î§ÄÚ¹²Ïí£¬ËùÓÐÓû§¶¼¿ÉÒԸıä»òÕßÉèÖÃÆäÖµ£¬¹ÊÖ»Ó¦ÓüÆÊýÆ÷µÈÐèҪȫ¾Ö±äÁ¿µÄµØ·½
//setting Application
Application["name"] == "hello";
//get Application
string name = Application["name"].ToString();
Î塢ʹÓÃPostBackUrl()
//sourcePage default1.aspx
<asp:Button ID="Button1" Runat="server" Text="PostToAnotherPage" PostBackUrl="~/default2.aspx">
</asp>
//targetPage default2.cs
if (PreviousPage != null)
{
TextBox tb = (TextBox)Previous.FindControl("TextBox1");
string str = tb.Text;
}
Áù¡¢Ê¹ÓÃServer.Transfer·½·¨
Õâ¸ö²Å¿ÉÒÔ˵ÊÇÃæÏò¶ÔÏ󿪷¢ËùʹÓõķ½·¨
ʹÓÃServer.Transfer·½·¨°ÑÁ÷³Ì´Óµ±Ç°Ò³ÃæÒýµ¼µ½ÁíÒ»¸öÒ³ÃæÖУ¬ÐµÄÒ³ÃæʹÓÃÇ°Ò»¸öÒ³ÃæµÄÓ¦´ðÁ÷£¬ËùÒÔÕâ¸ö·½·¨ÍêÈ«ÃæÏò¶ÔÏóµÄ£¬¼ò½àÓÐЧ¡£
ÏÂÃæÕâ¸ö´úÂëÊÇչʾÔÚÐèÒªºÜ¶à¸ö²ÎÊýµÄʱºòʹÓõķ½·¨£¬Èç¹û²ÎÊý±È½ÏÉÙ¾ÍûÓбØҪʹÓÃÕâ¸ö·½·¨ÁË
Èç¹ûÈÃËùÓеIJé
Ïà¹ØÎĵµ£º
½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
±¾ÏµÁÐÎÄÕÂͨ¹ýÒ»¸öÐéÄâµÄ°¸Àý——¡¶MVC¹«¸æ·¢²¼ÏµÍ³¡·µÄ¿ª·¢¹ý³Ì£¬È«ÃæչʾÁËASP.NET MVCµÄ»ù±¾Ê¹Ó÷½·¨£¬Í¬Ê±ÔÚÌÖÂÛÁËÕâ¸ö¿ò¼ÜµÄ»ù±¾ÔÀí¡£
Õâ¸öÎÄÕÂϵÁеÄÄ¿µÄ¾ÍÊÇʹÅóÓÑÃǸüÇáËɵÄÈëÃÅASP.NET MVC¡£
Õâ¸öϵ ......
Ê×Ïȼòµ¥½éÉÜһϠWCF ÊÇʲô£¬È»ºóÔÙ¶Ô WCF ºÍ Asp.net Web service ×ö¸ö±È½Ï¡£
Windows Communication Foundation (WCF) ÊÇÓÃÓÚ¹¹½¨ÃæÏò·þÎñµÄÓ¦ÓóÌÐòµÄ¿ò¼Ü¡£½èÖú WCF£¬¿ÉÒÔ½«Êý¾Ý×÷ΪÒì²½ÏûÏ¢´ÓÒ»¸ö·þÎñÖÕ½áµã·¢ËÍÖÁÁíÒ»¸ö·þÎñÖÕ½áµã¡£·þÎñÖÕ½áµã¿ÉÒÔÊÇÓÉ IIS ³ÐÔصijÖÐø¿ÉÓõķþÎñµÄÒ»²¿·Ö£¬Ò²¿É ......
Ò»£¬Ç°ÑÔ
CookiesÏë±ØËùÓÐÈ˶¼Á˽⣬ µ«ÊÇδ±ØËùÓÐÈ˶¼¾«Í¨¡£±¾ÎĽ²½âÁËCookiesµÄ¸÷·½Ãæ֪ʶ£¬ ²¢ÇÒÌá³öÀ´ÁË×î¼Ñʵ¼ù¡£ÕâÊDZÊÕßÔÚÈÕ³£¹¤×÷ÖеĻýÀۺͳÁµí¡£
¶þ£¬»ù´¡ÖªÊ¶
1.ʲôÊÇCookies
Cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæ×ÅÓû§ÇëÇóºÍÒ³ÃæÔÚ Web ·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Cookie °üº¬Ã¿´ÎÓû§·ÃÎÊÕ¾µãʱ Web Ó¦ÓóÌÐò¶¼¿ ......