ASP.NET¿çÒ³Ãæ´«Öµ·½·¨
1. ʹÓÃQueryString±äÁ¿
QueryString¿ÉÒÔ½«´«Ë͵ÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖÐ.Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ,¿ÉÒÔʹÓÃÕâ¸ö·½·¨.µ«ÊǶÔÓÚ´«µÝÊý×é»ò¶ÔÏóµÄ»°,¾Í²»ÄÜÓÃÕâ¸ö·½·¨ÁË.ÏÂÃæÊÇÒ»¸öÀý×Ó£º
a.aspxµÄC#´úÂë
private void Button1_Click( object sender, System.EventArgs e )
{
string s_url;
s_url = "b.aspx?name=" + Label1.Text;
Response.Redirect( s_url );
}
b.aspxÖÐC#´úÂë
private void Page_Load( object sender, EventArgs e )
{
Label2.Text = Request.QueryString["name"];
}
2. ʹÓÃApplication ¶ÔÏó±äÁ¿
Application¶ÔÏóµÄ×÷Ó÷¶Î§ÊÇÕû¸öÈ«¾Ö,Ò²¾ÍÊÇ˵¶ÔËùÓÐÓû§¶¼ÓÐЧ.Æä³£Óõķ½·¨ÓÃLockºÍUnLock.
a.aspxµÄC#´úÂë
private void Button1_Click( object sender, System.EventArgs e )
{
Application["name"] = Label1.Text;
Server.Transfer( "b.aspx" );
}
b.aspxÖÐC#´úÂë
private void Page_Load( object sender, EventArgs e )
{
string name;
Application.Lock( );
name = Application["name"].ToString( );
Application.UnLock( );
}
3. ʹÓÃSession±äÁ¿
Ïë±ØÕâ¸ö¿Ï¶¨ÊÇ´ó¼ÒʹÓÃÖÐ×îƵ·±µÄ£¬Æä²Ù×÷ÓëApplicationÀàËÆ,×÷ÓÃÓÚÓû§¸öÈË,µ«¹ýÁ¿µÄ´æ´¢»áµ¼Ö·þÎñÆ÷ÄÚ´æ×ÊÔ´µÄºÄ¾¡?
a.aspxµÄC#´úÂë
private void Button1_Click( object sender, System.EventArgs e )
{
Session["name"] = Label.Text;
}
b.aspxÖÐC#´úÂë
private void Page_Load( object sender, EventArgs e )
{
string name;
name = Session["name"].ToString( );
}
4. ʹÓÃCookie¶ÔÏó±äÁ¿
Õâ¸öÒ²ÊÇ´ó¼Ò³£Ê¹Óõķ½·¨,ÓëSessionÒ»Ñù,ÆäÊÇʲ¶Ôÿһ¸öÓû§¶øÑÔµÄ,µ«ÊÇÓиö±¾ÖʵÄÇø±ð,¼´CookieÊÇ´æ·ÅÔÚ¿Í»§¶ËµÄ,¶øsessionÊÇ´æ·ÅÔÚ·þÎñÆ÷¶ËµÄ.¶øÇÒCookieµÄʹÓÃÒªÅäºÏasp.NETÄÚÖöÔÏóRequestÀ´Ê¹ÓÃ.
a.aspxµÄC#´úÂë
private void Button1_Click( object sender, System.EventArgs e )
{
HttpCookie cookie_name = new HttpCookie( "name" );
cookie_name.Value = Label1.Text;
Reponse.AppendCookie( cookie_name );
Server.Transfer( "b.aspx" );
}
b.aspxÖÐC#´úÂë
private void Page_Load( object sender, EventArgs e )
{
string name;
name = Request.Cookie["name"].Value.ToString( );
}
5. ʹÓÃServer.Transfer·½·¨
Ïà¹ØÎĵµ£º
char[] constant = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', ......
¹«Ë¾ÒªÇ󿪷¢Ò»¸ö¼Ì³ÐSystem.Windows.Forms.ListViewÀàµÄ×é¼þ£¬ÒªÇó´ïµ½ÒÔϵÄÌØÊ⹦ÄÜ£ºµã»÷ListView¸÷ÁÐÁÐͷʱ£¬ÄÜ°´ÕÕµã»÷ÁеÄÿÐÐÖµ½øÐÐÖØÅÅÊÓͼÖеÄËùÓÐÐÐ (ÅÅÐòµÄ·½Ê½ÈçDataGridÏàËÆ)¡£¸ù¾ÝÄúµÄ֪ʶ£¬Çë¼òҪ̸һÏÂÄúµÄ˼· £¿
Ö±½Ó·ÅÉÏ´úÂ룺
using System;
using System.Collections.Generic;
using System.Comp ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Sha ......
1.¾¡Á¿Ê¹ÓÃHtml¾²Ì¬Ò³Ãæ¡£aspxÔÚÊý¾Ý½»»¥·½ÃæÓкܺõĵĽ»»¥ÄÜÁ¦£¬µ«ÊÇÒ²»áÏûºÄÒ»¶¨µÄ·þÎñÆ÷×ÊÔ´£¬ËùÒÔÎÒÃǾ¡Á¿Óô¿htmlµÄҳȥʵÏÖ¡£×îÖØÒªµÄCMSµÄÓ¦ÓÃ
2.±ÜÃâ²»±ØÒªµÄ»ØËͲÙ×÷£¬Ã¿´Îµ¥»÷Ò³Ãæ°´Å¥¶¼Òª¼ÓÔØPage_Loadʼþ£¬ÓÃPage.IsPostBack±ÜÃâ²»±ØÒªµÄ¼ÓÔØ
3.¾¡Á¿ÔÚ¿Í»§¶Ë½øÐÐÑéÖ¤²Ù×÷£¬Í¨¹ýjs½øÐÐʵÏÖ
4.ÓÅÏÈʹÓÃHtml¿ ......
0¡¢ÒýÑÔ
¡¡¡¡Web Ò³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃAsp.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´«µÝÊý¾Ý ......