ASP.NET¿çÒ³Ãæ´«Öµ¼¼ÇÉ
1. ʹÓÃQueryString±äÁ¿
¡¡¡¡¡¡¡¡QueryStringÊÇÒ»Öַdz£¼òµ¥µÄ´«Öµ·½Ê½£¬Ëû¿ÉÒÔ½«´«Ë͵ÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖС£Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨¡£µ«ÊǶÔÓÚ´«µÝÊý×é»ò¶ÔÏóµÄ»°£¬¾Í²»ÄÜÓÃÕâ¸ö·½·¨ÁË¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
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
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
ÔÚÒ³Ãæ»ùÀàÖÐÔö¼ÓÒÔÏ·½·¨,Äܹ»»ñµÃ±Èoverride void OnError(EventArgs e)¸ü¸ßµÄ´íÎó´¦ÀíÓÅÏȼ¶ºÍ¿ØÖÆȨ,override void OnError(EventArgs e)·½Ê½ÖÐOnError±»Ö´ÐÐÍê±Ïºó»ùÀà(Page)µÄOnErrorÔÚºóÐø±»µ÷ÓÃ,µ±Ç°Ò³ÃæË漴ɥʧ¿ØÖÆȨ.
protected void Page_Error(object sender, EventArgs e)
{
&nb ......
¼ÙÉèÔÚ·þÎñÆ÷µÄ¸ùĿ¼ÏÂÓиöÃûΪDownloadµÄÎļþ¼Ð,Õâ¸öÎļþ¼Ð´æ·ÅһЩÌṩ¸øÒýÓóÌÐòÏÂÔصÄÎļþ..
public void DownloadFile(string path, string name)
{
try
{
......
¡¡¡¡.Net ÀïÉÏ´«´óÎļþʱ£¬»áÓöµ½³¬Ê±»òHTTP500´íÎ󣬽â¾öµÄ°ì·¨ÓÐÁ½ÖÖ£ºÒ»ÖÖÊÇÐÞ¸ÄÅäÖã¬ÁíÒ»ÖÖ¾ÍÊÇÓõÚÈý·½¿Ø¼þ¡£ÕâÀï½éÉÜÒ»ÏÂÐÞ¸ÄÅäÖõġ£
ÐèÒªÐ޸ĵÄÊÇ
ÔÚ C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIGĿ¼À
ÕÒµ½ÎļþmaxRequestLength="4096"
½«ÖµÐ޸ĴóһЩ£¬ÀýÈ磺102400
Õâ¸ö²ÎÊýµÄµ¥Î»Ó¦¸ÃÊ ......
¡¡¡¡×Ô´ÓÉÏ´ÎÓÐÁËÒ»´ÎÆƽâÑéÖ¤ÂëµÄ¾Ñéºó£¬¾ÍÒ»Ö±Ïë×Ô¼ºÐ´¸öÏñÑùµãµÄÑéÖ¤Âë¡£½ñÌìÎÞÁÄËùÒÔ¾ÍдÁË£¬×ÜÌåÉÏÀ´Ëµ»¹ËãºÜÂúÒâ¡£¾ÍÊÇÓÐʱ¸´ÔÓµÃÈâÑÛ¶¼¿´²»³öÊÇɶ£¨ÕâÒ²¸úͼƬ̫СÓйØϵ£©¡£
¡¡¡¡Õâ¸öÑéÖ¤ÂëÖ§³ÖËæ»ú×ÖÌå¡¢×ÖÌå´óС¡¢×ÖÌåÑùʽ£¨ÆÕͨ¡¢´ÖÌ塢бÌ壩¡¢×ÖÌåÑÕÉ«¡¢×Ô¶¨Òå×Ö·ûµÈ¡£
¡¡¡¡´úÂëÖеÄlibFontÊÇ×ÖÌå¿â£¬libC ......