ASP.NET»ñÈ¡¿Í»§¶ËIP/Óû§ÃûµÈÐÅÏ¢
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
 
Ïà¹ØÎĵµ£º
VS2010ÔÚ4Ô·ÝÒѾÕýʽ·¢²¼ÁË£¬Asp.Net 4.0¸øÎÒ´øÀ´ÁËһЩеĶ«Î÷¡£ÌåÑéÒ»°Ñ¡£
1. ´ÓÒ³Ãæ±ê¼Ç<%%>˵Æð
2. Asp.Net 4.0 ÖпÉÒÔÓÃ×Ô¶¨ÒåµÄProvider×öOutputCache ÁË
3. SEOÔöÇ¿Ö§³ÖMetaKeywords£¬ºÍMetaDescription£¬RedirectPermanant
4. SEOÔöÇ¿Ö®URL Routing
5. Êä³ö¸ü´¿¾»µÄHtml´úÂ룬ViewStateModeºÍClientI ......
ASP.NET 4µÄWeb Formsµ±ÖУ¬×îÁîÈ˼¤É͵ģ¬ÔòĪ¹ýÓÚÊÇURL Routing»úÖƵÄÈ«ÃæÖ§³Ö¡£¹ýÈ¥ÔÚASP.NET 3.5 SP1µ±ÖУ¬Web Forms»ò¶à»òÉپͿªÊ¼Ö§³ÖURL Routing»úÖÆ£¬ËüÈÃÎÒÃÇÔÚÍøÖ·µÄ³ÊÏÖÒÔ¼°Ê¹ÓÃÉϸü¼ÓµÄÓе¯ÐÔ¡£
¹ýÈ¥ÎÒÃÇÔÚASP.NETµ±ÖУ¬Ï°¹ßÓÚµ×ÏÂÕâÑùµÄÍøÖ·³ÊÏÖ·½Ê½£º
http://myWebSite/EditProduct.aspx?Id=1
µ«×î½ü¼¸ÄêR ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MSXML2;
using System.Text.Regula ......
//»ñÈ¡ÈÕÆÚ+ʱ¼ä
DateTime.Now.ToString(); // 2008-9-4 20:02:10
DateTime.Now.ToLocalTime().ToString(); // 2008-9-4 20:12:12
//»ñÈ¡ÈÕÆÚ
DateTime.Now.ToLongDateString().ToString(); // 2008Äê9ÔÂ4ÈÕ
D ......
1. INTRODUCTION
´óÁ¿µÄÍøÕ¾Ò³ÃæÊDzÉÓö¯Ì¬µÄ·½Ê½£¬¸ù¾ÝÓû§Ìá½»µÄ²»Í¬ÇëÇó´´½¨Éú³ÉÒ³Ãæ¡£ÕýÈçÎÒÃÇËùÖªµÄ£¬¶¯Ì¬Ò³ÃæÓÐÖúÓÚ¸ù
¾ÝÓû§ÒªÇóÀ´Ìṩ¶¨ÖƵĶ¯Ì¬ÄÚÈÝ¡£¶¯Ì¬Ò³ÃæÒ²ÀûÓÚ»ñÈ¡ÔÚÊý¾Ý¿âÖÐÿʱÿ¿Ì¸üеÄ×ÊÁÏ¡£È±µãÊÇΪÿ¸öÓû§ÇëÇóÉú³ÉͬһҳÃæÔö¼ÓÁËϵͳ¿ªÏú¡£
ASP.NET
ÌṩÁË»º´æ¼¼ÊõÓ ......