ASP.NETÒ³ÃæÖ®¼ä´«µÝÖµµÄ¼¸ÖÖ·½·¨
ASP.NETÖÐʵÏÖÒ³Ãæ¼äµÄ²ÎÊý´«µÝ (תÔØ)
£¨QueryString\Application\Session\Cookie £©
Ò».ʹÓÃQueryString
Request.QueryString
ÔÚASPʱ´ú£¬Õâ¸öÊǽϳ£Óõķ½·¨£¬µ½ÁËASP.NET£¬ºÃÏñÓõÄÈ˲»¶àÁË£¬µ«ÊDz»¹ÜÔõô˵£¬ÕâÊÇÒ»¸öûÓйýʱ£¬ÇÒºÜÖµµÃÍƼöµÄ·½·¨£¬ÒòΪ²»¹ÜÊÇASP»¹ÊÇASP.NET£¬×î»ù±¾µÄ¶¼»¹ÊÇ»ùÓÚHTTpÐÒéµÄ¡£ ȱµãÊǷdz£Ã÷ÏԵģ¬ÈÃÔÚ¶à¸öÒ³Ãæ´«µÝʱ£¬¿ÉÄܾÍRequest²»µ½ÁË
ʹÓÃQueryStringÔÚÒ³Ãæ¼ä´«µÝÖµÊÇÒ»Öַdz£³£¼ûµÄ·½·¨£¬ÎÒÃÇÔÚASPÖоͳ£³£Óõ½¡£
(1)ÓŵãºÍȱµã
Óŵ㣺
1.ʹÓüòµ¥£¬¶ÔÓÚ°²È«ÐÔÒªÇ󲻸ßʱ´«µÝÊý×Ö»òÊÇÎı¾Öµ·Ç³£ÓÐЧ¡£
ȱµã£º
1.ȱ·¦°²È«ÐÔ£¬ÓÉÓÚËüµÄÖµ±©Â¶ÔÚä¯ÀÀÆ÷µÄURLµØÖ·Öеġ£
2.²»ÄÜ´«µÝ¶ÔÏó¡£
(2)ʹÓ÷½·¨
1.ÔÚÔ´Ò³ÃæµÄ´úÂëÖÐÓÃÐèÒª´«µÝµÄÃû³ÆºÍÖµ¹¹ÔìURLµØÖ·¡£
2.ÔÚÔ´Ò³ÃæµÄ´úÂëÓÃResponse.Redirect(URL);Öض¨Ïòµ½ÉÏÃæµÄURLµØÖ·ÖС£
3.ÔÚÄ¿µÄÒ³ÃæµÄ´úÂëʹÓÃRequest.QueryString["name"];È¡³öURLµØÖ·Öд«µÝµÄÖµ¡£
(3)Ó¦ÓþÙÀý
1.Ô´Ò³Ãæ*.aspxµÄ´úÂ룺
private void Button1_Click(object sender, System.EventArgs e)
{
string urlAddress;
string Name1;
string Name2;
string Name3;
string Name1Value = "HelloName1";
int Name2Value = 1234567;
string Name3Value = "ÄãºÃÃû³Æ3";
urlAddress = "destinationWebForm.aspx?Name1=" + Name1Value + "&" + "Name2=" + Name2Value.ToString() + "&" + "Name3=" + Name3Value;
Response.Redirect(urlAddress);
}
2.Ä¿µÄÒ³ÃædestinationWebForm.aspxµÄ´úÂë:
private void Page_Load(object sender, System.EventArgs e)
{
string myName1Value;
int myName2Value;
string myName3Value;
myName1Value = Req
Ïà¹ØÎĵµ£º
ÒªÔÚVS2005ÖÐʹÓÃsqlhelperÀà,±ØÐë°ÑMicrosoft.ApplicationBlocks.Data.dllÒýÓõ½ÏîÄ¿ÖÐ.
1.ͨ¹ý´æ´¢¹ý³Ì²éѯµÄ·½·¨SqlHelper.ExecuteDataset(Êý¾Ý¿âÁ¬½Ó×Ö·û, ´æ´¢¹ý³Ì×Ö·û, ²ÎÊýÊý×é);
2.ͨ¹ý×Ö·û´®²éѯµÄ·½·¨SqlHelper.ExecuteDataset(Êý¾Ý¿âÁ¬½Ó×Ö·û, CommandType.Text , ²éѯ×Ö·û´®,²ÎÊýÊý×é);
3.ͨ¹ý´æ´¢¹ý³Ì²åÈëµ ......
±»ÃæÊÔµÃÓÐÒ»²¿·ÖÌâÊ«Ö÷¹ÛµÄ£¬ÊÓ×ÔÉíÇé¿ö°É£¬ÏÂÃæÊÇÎÒ²»»áµÄÁË£¬²éÒ»²é¼ÇÏÂÁË¡£
1¡¢net³£ÓÃÀà¿â£¬ÍøÂçµÄÀà¿â£º
£¨1£© ASP.NET×Ô¶¯µ¼ÈëµÄ£º
System
System.Collections
System.Text
&nb ......
±íµ¥formµÄÌá½»ÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇgetµÄ·½·¨£¬Ò»ÖÖÊÇpost µÄ·½·¨.¿´ÏÂÃæ´úÂë,Àí½âÁ½ÖÖÌá½»µÄÇø±ð:
1 <form id="form1" method="get" runat="server">
2 <div>
3 ÄãµÄÃû×Ö<asp:TextBox ID="name" runat="server"></asp ......
ÔÚÓÃVS2008µ÷ÊÔÍøÕ¾µÄʱºò£¬Í»È»Ò³Ãæ²»ÄÜÕý³£ÏÔʾÁË£¬IEÏÔʾ“ÎÞ·¨ÏÔʾ¸ÃÍøÒ³”¡£
Ö¢×´Ò»£º
¡¡¡¡IEµØÖ·À¸ÀïÃæÏÔʾµÄ¶Ë¿ÚºÅºÍ×ÀÃæÈÎÎñÀ¸ÓÒϽǓASP.NET Development Server”µÄ¶Ë¿Ú²»Ò»Ö£¬¶ø°ÑIEµØÖ·À¸µÄ¶Ë¿ÚºÅ¸Ä³É“ASP.NET Development Server”ÏÔʾµÄ¶Ë¿ÚºÅ£¬½á¹ûÍøÒ³¾ÍÄܳöÀ´¡£
½â¾ö ......