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

ASP.NET»ñÈ¡¿Í»§¶ËIP/Óû§ÃûµÈÐÅÏ¢

1. ÔÚASP.NETÖÐרÓÃÊôÐÔ£º
»ñÈ¡·þÎñÆ÷µçÄÔÃû£ºPage.Server.ManchineName
»ñÈ¡Óû§ÐÅÏ¢£ºPage.User
»ñÈ¡¿Í»§¶ËµçÄÔÃû£ºPage.Request.UserHostName
»ñÈ¡¿Í»§¶ËµçÄÔIP£ºPage.Request.UserHostAddress
2. ÔÚÍøÂç±à³ÌÖеÄͨÓ÷½·¨£º
»ñÈ¡µ±Ç°µçÄÔÃû£ºstatic System.Net.Dns.GetHostName()
¸ù¾ÝµçÄÔÃûÈ¡³öÈ«²¿IPµØÖ·£ºstatic System.Net.Dns.Resolve(µçÄÔÃû).AddressList
Ò²¿É¸ù¾ÝIPµØÖ·È¡³öµçÄÔÃû£ºstatic System.Net.Dns.Resolve(IPµØÖ·).HostName
3. ϵͳ»·¾³ÀàµÄͨÓÃÊôÐÔ£º
µ±Ç°µçÄÔÃû£ºstatic System.Environment.MachineName
µ±Ç°µçÄÔËùÊôÍøÓò£ºstatic System.Environment.UserDomainName
µ±Ç°µçÄÔÓû§£ºstatic System.Environment.UserName   
4. if(Request.ServerVariables["HTTP_VIA"]!=null){   string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}else{
string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
}    
5.<%=Request.UserHostAddress%>
6.»ñÈ¡¿Í»§¶ËIP:
private string GetClientIP()
   {
    string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
    if (null == result || result == String.Empty)
    {
     result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    }
    if (null == result || result == String.Empty)
    {
     result = HttpContext.Current.Request.UserHostAddress;
    }
    return result;
   }
»ñÈ¡MACµØÖ·:
[DllImport("Iphlpapi.dll")]
   private static extern int SendARP(Int32 dest,Int32 host,ref Int64 mac,ref Int32 length);
   [DllImport("Ws2_32.dll")]
   private static extern Int32 inet_addr(string ip);
   private void Page_Load(object sender, System.EventArgs e)
   {
    // ÔÚ´Ë´¦·ÅÖÃÓû§´úÂëÒÔ³õʼ»¯Ò³Ãæ
    try
    {
    


Ïà¹ØÎĵµ£º

ASP.NetµÄUpdatePanel¿Ø¼þµÄ¼òµ¥Ê¹ÓÃ

¼¸ÖÖUpdatePanel¿Ø¼þµÄ×î¼òµ¥µÄÓ÷¨.
1.ÔÚUpdatePanel¿Ø¼þÀíµÄ×ӿؼþÖ±½Ó¾Ö²¿Ë¢ÐÂÄÚÈÝ.
Ó÷¨ÈçÏÂ
 Ê×ÏȱØÐëÏÈÍÐÒ»¸öScriptManager¿Ø¼þ·ÅÔÚÒ³ÃæÄÚ,
 ÔÚÍÐÒ»¸öupdatePanel¿Ø¼þ
ÔÚContentTemplateÀïÃæ·ÅҪˢеÄÄÚÈݺͰ´Å¥,
½«updatePanelµÄUpdateMode="Conditional",
ÕâÑù°´Å¥Ê¼þ½«ÔÚ¾Ö²¿Ë¢Ð¿ؼþÀïÃæµÄÄÚÈ ......

ASP.NET ÖÐÒ³ÃæÖ®¼äµÄ²ÎÊý´«µÝ

×ܽá³öÒÔϼ¸¸ö´«µÝ²ÎÊýµÄ·½·¨£º
µÚÒ»ÖÖ·½·¨£º
ͨ¹ýURLÁ´½ÓµØÖ·´«µÝ
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
    {
        Request.Redirect("Default2.aspx?username=honge");
    }
receive.aspx:
s ......

ASP.NET³ÌÐòµ÷ÊÔ¾­³£ÒªÓõĸ¨Öú¹¤¾ß

ÔÚ½øÐÐASP.NETµ÷ÊÔµÄʱºò£¬ÎÒÃǾ­³£ÐèÒª½èÖúһЩÍⲿ¹¤¾ßÀ´¸¨ÖúÎÒÃÇ¡£Ë×»°Ëµ£¬¹¤ÓûÉÆÆäÊ ±ØÏÈÀûÆäÆ÷¡£¿É±ðС¿´ÁËÕâЩ¹¤¾ß£¬ËüÊÇÄã½â¾ö¸´ÔÓÎÊÌâµÄ±Ø±¸ÀûÆ÷¡£±È½Ï³£ÓõÄÓÐÕâЩ£º
HTTP×¥°ü¹¤¾ß£º Microsoft Network Monitor£¬Fiddler2£¬HttpWatcher µÈ£¬Ö÷ÒªÓÃÀ´²é¿´HTTPÏûÏ¢µÄheader£¬ÒÔ¼°body¡£ http://www.mscto.com
´ ......

¡¾C#+ASP.NET¡¿ASP.NET¿çÒ³Ãæ´«Öµ¼¼ÇÉ×ܽá(ת)

¡ï1.  Ê¹ÓÃQueryString±äÁ¿
¡¡¡¡¡¡QueryStringÊÇÒ»Öַdz£¼òµ¥µÄ´«Öµ·½Ê½£¬Ëû¿ÉÒÔ½«´«Ë͵ÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖС£Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨¡£µ«ÊǶÔÓÚ´«µÝÊý×é»ò¶ÔÏóµÄ»°£¬¾Í²»ÄÜÓÃÕâ¸ö·½·¨ÁË¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
a.aspxµÄC#´úÂë
private void B ......

6ÖÖ³£ÓÃASP.NETÑéÖ¤¿Ø¼þ


ASP.NET³£ÓõÄ6ÖÖÑéÖ¤¿Ø¼þ£¬ÈçÏ£º
RequiredFieldValidator £¨±ØÐë×Ö¶ÎÑéÖ¤£© ÓÃÓÚ¼ì²éÊÇ·ñÓÐÊäÈëÖµ  
CompareValidator £¨±È½ÏÑéÖ¤£© °´É趨±È½ÏÁ½¸öÊäÈë  
RangeValidator £¨·¶Î§ÑéÖ¤£© ÊäÈëÊÇ·ñÔÚÖ¸¶¨·¶Î§  
RegularExpressionValidator £¨Õ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ