Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NET ÖпؼþµÄEnableViewState

ÔÚASP.NetÖжԸ÷¸öWebForm¿Ø¼þÒýÈëÒÔǰûÓеÄEnableViewStateÊôÐÔ¡£Õâ¸öÊôÐÔ¾¿¾¹ÓÐʲôÓá£ÎÒÃÇÖªµÀ¶ÔÓÚWebForm¶øÑÔ£¬Æä´úÂëÊÇÔÚ·þÎñÆ÷¶ËµÄ£¬ÒÔ´¦Àí¿Í»§¶ËµÄÇëÇó¡£µ±Óû§Í¨¹ýä¯ÀÀÆ÷ä¯ÀÀÍøÒ³µÄʱºò£¬»á¶ÔÍøÒ³½øÐÐijЩ²Ù×÷£¬±ÈÈç´ò¿ªÐÂÁ´½Ó£¬»òµ¥»÷ij¸ö°´Å¥¡£ÔÚASPÖУ¬ÕâЩÊÇͨ¹ý½Å±¾ÓïÑÔ¶ÔÆä½øÐд¦Àí£¬Ö®ºóÔÙ´«µÝ¸ø·þÎñÆ÷¶Ë¡£µ«ÊÇÔÚASP.NETÏ£¬ÓÉÓÚ²ÉÓÃÁËcode behind¼¼Êõ£¬ÔÚcodingµÄʱºò£¬Í¨³£Êǽ«ÒÔÇ°¿Í»§¶ËÍê³ÉµÄ¹¤×÷·Åµ½ÁË·þÎñÆ÷¶Ë¡£
ÄÇô£¬·þÎñÆ÷ÊÇÔõô֪µÀ¿Í»§µÄ²Ù×÷µÄÄØ£¿±ÈÈçÎÒÔÚÎı¾¿òÊäÈëµÄÄÚÈÝ£¬»òÕßµ¥»÷Á˵Ǽ°´Å¥£¬·þÎñÆ÷¶ËÊÇÔõÑùµÃµ½ÕâЩÐÅÏ¢µÄÄØ£¿ÒòΪûÓÐÕâЩÐÅÏ¢£¬·þÎñÆ÷¶Ë¾ÍÎÞ·¨ÏìÓ¦¿Í»§µÄÇëÇó¡£Ô­Àí¾ÍÊÇASP.NETÒýÓÃÁËviewstateµÄ»úÖÆ¡£ÔÚ·þÎñÆ÷¶Ë±£´æÁËÍøÒ³¸÷¸ö¿Ø¼þ¼°Ò³ÃæµÄ״̬£¬ÕâÆäÖаüÀ¨¸÷¸ö¿Ø¼þÔÚÒ³ÃæÉϵIJ¼¾Ö£¬ºÍËûÃǸ÷×ÔµÄÊôÐÔ¡£ÕâЩֵ¾Í±£´æÔÚViewStateÏ¡£ÎÒÃÇ¿ÉÒÔ¹Û²ìAspxÒ³ÃæµÄhtmlÔ´´úÂ룬¼ÙÉèÕâ¸öÒ³ÃæÉÏÓÐÒ»¸öbutton°´Å¥£¬ºÍÒ»¸ölistBox¿Ø¼þ£¬htmlÎļþÈçÏ£º
<input type="hidden" name="__VIEWSTATE" value="dDwzODYzNDM5NTU7Oz7FvviJbq45bDa7QJaumIiOhZ8mOQ==" />
 <input type="submit" name="Button1" value="Button" id="Button1" style="height:40px;width:96px;Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 240px" />
 <select name="ListBox1" size="4" id="ListBox1" style="width:152px;Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 120px"></select>
ÎÒÃÇËüµÄ²»Í¬Ö®´¦£¬Ò»ÊÇÉÙÁËÒÔÇ°Ëù±ØÐëÏìÓ¦¿Í»§¶ËʼþµÄ½Å±¾ÓïÑÔ£¬Ò»ÊǶàÁËÒ»¸öÃûΪ”_VIEWSTATE”µÄÊôÐÔ¡£ÆäÖµÊÇÒ»³¤´®×Ö·û¡£ÀàÐÍΪ“hidden”¡£Õâ¸öÖµ¼Ç¼µÄ¾ÍÊǸ÷¸ö¿Ø¼þºÍÒ³ÃæµÄ״̬ÐÅÏ¢¡£µ±Óû§¶ÔÒ³Ãæ½øÐÐÏà¹Ø²Ù×÷µÄʱºò£¬×´Ì¬Öµ·¢Éú¸Ä±ä£¬²¢½«¸Ä±äµÄÖµ´«µÝ¸ø·þÎñÆ÷¶Ë¡£·þÎñÆ÷¶ËÔڱȽϸıäºóµÄ״ֵ̬ºÍ³õʼֵ֮¼äµÄÇø±ð£¬ÒÔÏìÓ¦¾ßÌåµÄÇëÇó¡£
Ò»µ©Ò³ÃæµÄ¿Ø¼þºÜ¶à£¬ÕâÖÖƵ·±µÄ´«µÝ¿Ø¼þ״ֵ̬¶ÔÍøÂçµÄÏûºÄÊǺܴóµÄ£¬Òò´Ë£¬ASP.NetÌṩÁËEnableViewStateÊôÐÔ£¬ÏµÍ³Ä¬ÈϵÄֵΪtrue¡£µ±ÉèÖÃΪtrueʱ£¬ÔÚ´«µÝ״ֵ̬ʱ¾Í°üÀ¨¸Ã¿Ø¼þ£»Èç¹ûÉèÖÃΪfalse£¬Ôò´«µÝ״ֵ̬ʱÔò²»°üÀ¨Ëü¡£¼ÈȻ״ֵ̬²»°üÀ¨¸Ã¿Ø¼þ£¬Ôò¿Í»§¶Ë¶ÔËü½øÐеIJÙ×÷£¬·þÎñÆ÷¶ËÊDz»ÏìÓ¦µÄ¡£
ÎÒÃÇ¿ÉÒÔ×ö¸öʵÑ飬ÔÚButton1_ClickʼþÖУ¬±àд´úÂ룺
ListBox.Items.Add(”¿Í»§¶Ëµã»÷°´Å¥Ò»´Î£¡”);
´ËʱÔ


Ïà¹ØÎĵµ£º

asp.net(c#)ÍøÒ³ÌøתÆßÖÖ·½·¨Ð¡½á

asp.net(c#)ÍøÒ³ÌøתÆßÖÖ·½·¨Ð¡½á
·¢²¼Ê±¼ä£º2009-11-25 11:13:03
¡¡¡¡1.Response.Redirect("http://www.yayiba.com",false);
¡¡¡¡Ä¿±êÒ³ÃæºÍÔ­Ò³Ãæ¿ÉÒÔÔÚ2¸ö·þÎñÆ÷ÉÏ£¬¿ÉÊäÈëÍøÖ·»òÏà¶Ô·¾¶¡£ºóÃæµÄboolֵΪÊÇ·ñÍ£Ö¹Ö´Ðе±Ç°Ò³¡£
ÌøתÏòеÄÒ³Ã棬ԭ´°¿Ú±»´úÌæ¡£"
ä¯ÀÀÆ÷ÖеÄURLΪз¾¶¡£
:Response.Redirect·½ ......

URL µÄ¸÷¸ö²¿·ÖºÍͨ¹ýASP.NET»ñÈ¡URLµØÖ·µÄ·½·¨


網Ö·£ºhttp://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.ApplicationPath
/
Request.PhysicalPath
D:\Projects\Solution\web\News\Press\Content.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)
D:\Projects\Solution\web\News\Press
Request.PhysicalApplicationPath
D ......

asp.net ¿Ø¼þ¿ª·¢»ù´¡(1)

Ô­ÌûµØÖ·£ºhttp://www.cnblogs.com/clingingboy/archive/2006/07/30/463471.html
asp.net±¾ÉíÌṩÁ˺ܶà¿Ø¼þ,Ìṩ¸øÎÒÃÇÕâЩ±È½ÏÀÁ¶èµÄÈËʹÓÃ,ÎÒÈÏΪ¿Ø¼þµÄ×÷ÓþÍÔÚ´Ë,ÒòΪÎÒÃDz»ÏëÖظ´¹¤×÷,ËùÒÔÒª´´½¨Ëü,Õâ¸ö±¾Éí±ãÊÇ
Ò»¸öÐèÇóµÄ¹Øϵ,ËùÒÔѧϰ¿Ø¼þ¿ª·¢ºÜÓÐÒâ˼.
wroxÍøÕ¾ÉÏÓб¾Êé Professional ASP.NET 2.0 Server Cont ......

ASP.NET Á¬½ÓÊý¾Ý¿â

Õâ¸ö¶«Î÷Ì«¾À½áÁË~Ìù³öÀ´´úÂ룬¹©´ó¼ÒÏíÓÃ
·ÖÈý¸ö²¿·Ö£º.config    .aspx      .aspx.cs
//web.config
<appSettings>
<add key="keystring" value="Data Source=ZRQ-PC;Initial Catalog=OnlineJudge;Integrated Security=True"/>
</appSettings>
......

ASP.NET 2.0ÖÐGridViewÎÞÏ޲㸴ÔÓ±íÍ·µÄʵÏÖ

ʵÏÖ·½·¨¾ÍÊǸøµ¥Ôª¸ñÌî³äÎÒÃÇÏëÒªµÄ¸ñʽ´úÂë¡£
 
 
==============C#==============
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script run ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ