Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ :

ASP.NETÒ³Ãæ´«Öµ_µÚÈýƪ_ViewState

+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
+++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
  ViewState["name"] = TextBox1.Text.Trim().ToString();
  ViewState["email"] = TextBox2.Text.Trim().ToString();
  Response.Write("ÐÕÃû£º" + ViewState["name"].ToString() + "</br>" +
         "µç×ÓÓʼþ£º" + ViewState["email"].ToString());
}
+++ ˵Ã÷
(1) Ëùν“ViewState[]”£¬ÔÚASP.NETÖУ¬ËùÓÐд´½¨µÄÒ³ÃæÄ¬ÈÏÇé¿ö϶¼»á¼Ì³ÐSystem.Web.UI.PageÀ࣬Õâ¸öÀàÓиöÊôÐÔ——“ViewState[]”£¬ËüÓÃÀ´ÔÚÄã¶Ôͬһ¸öÒ³ÃæµÄ¶à´ÎÇëÇóÖУ¬±£´æ·þÎñÆ÷¿Ø¼þµÄ״̬¡£
(2) ÎÒÃǶ¼ÖªµÀ£¬¿Í»§¶Ëÿ´ÎÏò·þÎñÆ÷ÇëÇóÒ³Ãæ£¬Ò³Ãæ¶¼»á±»ÖØÐÂˢУ¬ÕâÒâζ×Å£¬Äã֮ǰµÄÒ³ÃæÀïµÄ¶«Î÷¾Í»áÏûʧ£¬µ«Èç¹ûÄãÏë±£´æÄ³Ð©ÐÅÏ ......

ASP.NETÒ³Ãæ´«Öµ_µÚËÄÆª_Session

ÀýÒ»£º
+++ ÐÞ¸ÄGlobal.asaxÎļþ£º
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{  }
void Application_End(object sender, EventArgs e)
{  }
void Application_Error(object sender, EventArgs e)
{  }
void Session_Start(object sender, EventArgs e)
{
  Session["GlobalString"] = "TEST GLOBAL!!!";
}
void Session_End(object sender, EventArgs e)
{  }
</script>
+++ SeesionShare01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
  TextBox3.Text = Session["GlobalString"].ToString();
}
protected void Button1_Click(object s ......

ASP.NETÒ³Ãæ´«Öµ_µÚÎåÆª_Application

+++ ÐÞ¸ÄGlobal.asaxÎļþ£º
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
  Application["count"] = 0;
}
void Application_End(object sender, EventArgs e)
{  }
void Application_Error(object sender, EventArgs e)
{  }
void Session_Start(object sender, EventArgs e)
{  }
void Session_End(object sender, EventArgs e)
{  }
</script>
+++ ApplicationShare01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
  Application["name"] = TextBox1.Text.Trim().ToString();
  Application["email"] = TextBox2.Text.Trim().ToString();
  Server.Transfer("ApplicationShare02.aspx") ......

ASP.NETÒ³Ãæ´«Öµ_µÚÁùƪ_Cookie

+++ Cookie01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:TextBox ID="TextBox1" runat="server" ForeColor="Red" Width="182px">Name</asp:TextBox>
<asp:Button ID="BtnCookie" runat="server" OnClick="BtnCookie_Click" Text="BtnCookie" /><br />
++ ºǫ́´úÂëÈçÏ£º
protected void BtnCookie_Click(object sender, EventArgs e)
{
  Response.Cookies["Name"].Value = TextBox1.Text;
  Response.Cookies["Name"].Expires = DateTime.Now.AddDays(1);
  HttpCookie aCookie = new HttpCookie("lastVisit");
  aCookie.Value = DateTime.Now.ToString();
  aCookie.Expires = DateTime.Now.AddDays(1);
  Response.Cookies.Add(aCookie);
  Response.Redirect("Cookie02.aspx");
}
+++ Cookie02.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏÂ:
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
    #region ¶ÁÈ¡Cookie
    if (Request.Cookies["Name"] != null)
    {
        Response.Wri ......

ASP.NETÒ³Ãæ´«Öµ_µÚÆßƪ_HiddenField

+++ HiddenField01.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HiddenField2" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
++ ºǫ́´úÂ룬ÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
  HiddenField1.Value = "liuning";
  HiddenField2.Value = "liuning@hotmail.com";
  string strUrl = "HiddenField02.asp?name=" +
              HiddenField1.Value.ToString() + "&email=" + HiddenField2.Value.ToString();
  Response.Redirect(strUrl);
}
+++ HiddenField02.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂ룬ÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
  if (Request.QueryString["name"] != null && Request.QueryString["email"] != null)
  {
    Response.Write("ÐÕÃû£º" + Request.QueryString["name"].ToString() ......

ASP.NETÒ³Ãæ´«Öµ_µÚ°Ëƪ_WebConfig

+++ ÐÞ¸ÄWebConfigÎļþ£º
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="connStr" value="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"/>
  </appSettings>
  <connectionStrings>
    <add name="connStr" connectionString="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"
       providerName="System.Data.OracleClient"/>
  </connectionStrings>
 <system.web>
  <compilation debug="true">
   <assemblies>
    <add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral,
      PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
  <authentication mode="Windows"/>
 </system.web>
</configuration>
+++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
+++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, ......
×ܼǼÊý:40319; ×ÜÒ³Êý:6720; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [340] [341] [342] [343] 344 [345] [346] [347] [348] [349]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ