ASP.NET WEB.CONFIGÃô¸ÐÐÅÏ¢¼ÓÃÜѧϰ
½ñÌ죬¿´µ½PETSHOP4.0ÀïµÄWEB.CONFIG¶ÔÊý¾Ý¿âÁ¬½Ó×Ö·û´®¼ÓÃÜ£¬ËùÒÔÌØÒâѧϰ²¢¼Ç¼ÏÂÀ´¡£
.net ÌṩÁË System.Configuration.RsaProtectedConfigurationProvider ¡£
Ê×ÏÈÅäÖÃWEB.CONFIG
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configProtectedData>
<providers>
<clear />
<add name="KeyProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" keyContainerName="Key" useMachineContainer="true" />
</providers>
</configProtectedData>
<connectionStrings>
<add name="SQL_Northwind" connectionString="Data Source=localhost;Initial Catalog=Northwind;User ID=sa;Password=sa;" />
</connectionStrings>
</configuration>
asp.net ÌṩÁËÃüÁîÐеķ½Ê½£¬¶ÔÆä¼ÓÃÜ£¬ÕâÀïÎÒҲûÓоßÌåʵÀý£¬¾Í²»½²À²¡£
ÎÒ»¹ÊÇ°´ÕÕ³ÌÐòµÄ·½Ê½£¬Ð½¨Ò»¸öÒ³Ãæ
Ö´ÐÐÏÂÃæµÄ·½·¨£º
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("connectionStrings");
if (section != null && !section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection("KeyProvider");
config.Save();
}
·½·¨Ö´Ðкó£¬WEB.CONFIG ÎļþÓ¦¸ÃÓÐÀàËÆÒÔϵĴúÂë³öÏÖ£º
<connectionStrings configProtectionProvider="KeyProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<Encrypt
Ïà¹ØÎĵµ£º
//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//Êý¾Ý¿âµØÖ·
private string datapatch = "db/global.asa";//Êý¾Ý¿âµØÖ·
///
/// È¡µÃdataset
//
/// ²éѯÓï¾ä
///
public DataSet GetDataSet(string Commandtext)
{&nbs ......
Asp.netÖ§³ÖÈýÖÖÀàÐ͵Äcache
Ïëдһ¸ö¼¼Êõ¿ìËÙ¸ÅÊö£¬¿ÉÄÜдµÃÌ«¶àÁË¡£¼¼Êõ¸ÅÂÔµÄÄ¿µÄÊÇÒÔ×î¿ì×î¼òµ¥µÄ·½Ê½ÃèÊö³ö¼¼ÊõÒªµã£¬Ò²ÊÇÎÒÏ£ÍûµÄ×îÓÐЧÂʵÄ֪ʶ´«²¥·½Ê½¡£
1£® Ò³Ãæ/¿Ø¼þcache
2£® Ó¦ÓóÌÐò¼¶cache
3£® ä¯ÀÀÆ÷¿Í»§¶Ëcache
´ÓʵÏÖ·½Ê½À´¿´£¬Ò³Ãæ/¿Ø¼þcacheºÍÓ¦ÓóÌÐò¼¶cache¶¼ÊÇ´æ·ÅÔÚ·þÎñÆ÷ÄÚ´æÀïÃæµÄ£¬Ëæ×ÅÄÚ ......
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕÊ ......
³ÌÐò´úÂë
public static string GetRealIP()
{
string ip;
try
{
HttpRequest request = HttpContext.Current.Request;
if (request.ServerVariables["HTTP_VIA"] != null)
{
ip = request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString().Split(',')[0].Trim();
}
else
{
ip = requ ......
¹ØÓÚEXCELµÄ±¨±íµ¼³ö£¬¿¼Âǵ½µ¼³öºÄʱµÄÎÊÌâÎÒÖ÷Òª²ÉÓÃAJAXÀ´×öµÄ£¬·Ö±ð²¶×½¼¸¸öÆðֹ״̬£¬¸ø¿Í»§¶ËÌáʾ3¸ö״̬£ºÕýÔÚ¼ìË÷Êý¾Ý¡£¡£¡£---¡·×¼±¸µ¼³öÊý¾Ý¡£¡£¡£(Ö»ÊÇ´ÓÊý¾Ý¿â³É¹¦È¡³ö£¬»¹Ã»ÓжÁдexcelÎļþ)--¡·ÕýÔÚ¶ÁдÎļþ--¡·µ¼³öÊý¾Ý³É¹¦£¬µ±È»Èç¹ûÄÄÒ»¹ý³Ì³ö´í£¬¶¼ÓжÔÓ¦µÄÌáʾ£¬Ö»ËùÒÔÏ뵽дÕâƪÎÄÕ£¬Ö÷ÒªÊÇÒòΪ ......