c# asp.net »ñÈ¡¿Í»§¶Ë±íµ¥µÄÊý¾Ý
ÔÚweb³ÌÐòÖУ¬¾³£»áʹÓÃÔÚÒ»¸öÍøҳʹÓÃÆäËûÍøÒ³Ìá½»µÄÊý¾ÝÐÅÏ¢£¬ÕâÀï¿ÉÒÔʹÓÃRequestÄÚÖöÔÏóÀ´Íê³É£¬À´»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢£¬¸ù¾Ý¿Í»§¶ËÌá½»Êý¾Ý·½Ê½µÄ²»Í¬£¬Request¶ÔÏó·Ö±ðʹÓÃFormºÍQueryString¼¯ºÏÊôÐÔÀ´»ñÈ¡Êý¾Ý¡£ÏÂÃæÊÇÁ½ÖÖ¼¯ºÏ»ñÈ¡·½Ê½µÄ²»Í¬µã£ºÍ¨¹ýForm»ñÈ¡Êý¾ÝʱÔÚformÊôÐÔÖмòµ¥µÄÌí¼Óaction=“ÌøתµÄÍøÒ³µØÖ·”£¬<form. ID="idºÅ " runat=“sever” action=“ÒªÌøתµÄÍøÒ³URL”> </form>£¬¸Ã´«²Î·½Ê½ÊÇÒþʽµÄ£¬²»ÈÝÒ×±©Â¶£»ÁíÒ»ÖÖ·½Ê½ÊÇͨ¹ýget·½·¨Ìá½»±íµ¥Êý¾Ý£¬»òÒ³Ãæµ¼Ïòͨ¹ý“URL£¿Parameter=Value”¸ñʽ´«µÝ²ÎÊýֵʱ£¬¼´Ê¹ÓÃRequest¶ÔÏóQueryStringÊôÐÔ»ñÈ¡´«µÝ¹ýÀ´µÄÐÅÏ¢£¬Õâ¸ö´«²Î·½Ê½Ò»°ã²»½¨ÒéʹÓã¬ÒòÔÚURLÖ®ºó£¬ËùÒÔÈÝÒ×ÔÚä¯ÀÀÆ÷±©Â¶²ÎÊý£¬ÈÝÒ×ÔâÊܺڿ͵Ĺ¥»÷£¬ÔÙÕßÊÇURLµÄ×Ö½ÚÊýÓÐÏÞ£¬¼´´«µÝµÄ²ÎÊýÓÐÏÞ£¬ËùÒÔ²»½¨ÒéʹÓÃQueryString¡£
ÕâÀïÐèÒª½¨Á¢Á½¸öweb³ÌÐòÒ³£¬µÚÒ»¸öDefault.aspxÒ³ÖÐÔËÓø÷Öֿؼþ£¬µÚ¶þ¸öÊÇÔÚget-form.aspxµÄºǫ́´úÂëÖÐÔÚÒ³Ãæ¼ÓÔصÄʱºò»ñµÃDefault.aspxÒ³ÖУ¬Óû§Ìá½»µÄÐÅÏ¢Êý¾Ý¡£
Default.aspxµÄhtml´úÂ룺
view source
< id="highlighter_304109_clipboard" title="copy to clipboard" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="16" height="16" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash">
print?
01
<PREclass=brush:csharp><%@ Page Language="C#"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="form._Default"%>
02
03
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
04
05
<html xmlns="http://www.w3.org/1999/xhtml">
06
<head runat="server">
07
<title>ÎÞ±êÌâÒ³</title>
08
</head>
09
<body>
10
<form. id="Form1"action="get_form.aspx"method="post">
11
<div style="text-align:center">
12
ÌîдÓû§ÐÅÏ¢
13
<hr style="size:50%"/>
14
&
Ïà¹ØÎĵµ£º
ϵͳÀà
¡¡¡¡TypeÀ࣬ObjectÀ࣬StringÀ࣬ ArrayÀ࣬ConsoleÀ࣬ ExceptionÀ࣬GCÀ࣬ MarshalByRefObjectÀ࣬ MathÀà¡£
¡¡¡¡DateTime½á¹¹£¬Guid ½á¹¹£¬
¡¡¡¡ICloneable½Ó¿Ú£¬IComparable½Ó¿Ú£¬IConvertible½Ó¿Ú£¬ IDisposableÀ࣬
¡¡¡¡¼¯ºÏÀà
¡¡¡¡ICollection½Ó¿Ú£¬IComparer½Ó¿Ú£¬IDictionary½Ó¿Ú¡£IDictionaryEnume ......
Ò³Ãæ¼ÓÔØ˳ÐòÈçÏÂ:
Page.Init
Page.Load
Textbox.TextChanged
Button.Click
Page.PreRender
Page.Unload
ÔÚPage.Unload֮ǰ,Ò³Ãæ¾Í³ÊÏÖ³öÀ´ÁË.
page.initÖ»ÊÇÔÚÒ³ÃæµÚÒ»´ÎÔØÈëµÄʱºòÖ´ÐÐ,µ±Ò³Ãæpostbackºó´Ópage.load¿ªÊ¼Ö´ÐÐ.
e.g
<%@ Page Language="C#" AutoEventWireup="true" CodeBe ......
1.<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
Vs2005ºìÉ«ÁË£¬ÌáʾÕÒ²»µ½¸ÃÎļþ
ÓÚÊǸÄΪ.<script src="/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
½á¹ûºìɫûÓÐÁË£¬µ«ÊDZàÒëʱ±¨´í£¬ÕÒ²»µ½¸ÃÎļþ
½áÂÛ£º<script src="Script ......
´´½¨ºÍÅäÖÃASP.NET Session״̬Êý¾Ý¿â
ÔÚ»ùÓÚNLB£¨ÍøÂ縺ÔØƽºâ£©»·¾³ÏµÄASP.NET WebÓ¦ÓóÌÐò¿ª·¢£¬ÎÒÃÇÐèÒª½«Session´æ´¢ÔÚÊý¾Ý¿âÖ驶à¸öWebÓ¦ÓóÌÐòµ÷Óã¬ÒÔÏÂΪÅäÖ÷½·¨¼°×¢ÒâÊÂÏî¡£
1.´´½¨ÓÃÓÚ´æ´¢ASP.NET SessionµÄÊý¾Ý¿â£¨Ô¶³Ì¡¢±¾µØ½Ô¿É£¬Ê¹ÓÃÊý¾Ý¿âÓû§Éí·ÝÈÏÖ¤£©
ÔÚWindows\Microsoft.NET\Framework/V2.0.507 ......
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ¶¼¿ÉÓÃ
string name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µÄÇø±ð¹éÄ ......