ASP.NET³ÌÐòÖг£ÓôúÂë»ã×Ü
ASP.NET³ÌÐòÖг£ÓôúÂë»ã×Ü
1.×Ô¶¨ÒåÒì³£´¦Àí
//×Ô¶¨ÒåÒì³£´¦ÀíÀà
using System;
using System.Diagnostics;
namespace MyAppException
{
¡¡/// £¼summary£¾
¡¡/// ´ÓϵͳÒì³£ÀàApplicationException¼Ì³ÐµÄÓ¦ÓóÌÐòÒì³£´¦ÀíÀà¡£
¡¡/// ×Ô¶¯½«Òì³£ÄÚÈݼǼµ½Windows NT/2000µÄÓ¦ÓóÌÐòÈÕÖ¾
¡¡/// £¼/summary£¾
¡¡public class AppException:System.ApplicationException
¡¡{
¡¡¡¡public AppException()
¡¡¡¡{
¡¡¡¡¡¡if (ApplicationConfiguration.EventLogEnabled)LogEvent("³öÏÖÒ»¸öδ֪´íÎó¡£");
¡¡¡¡}
¡¡public AppException(string message)
¡¡{
¡¡¡¡LogEvent(message);
¡¡}
¡¡public AppException(string message,Exception innerException)
¡¡{
¡¡¡¡LogEvent(message);
¡¡¡¡if (innerException != null)
¡¡¡¡{
¡¡¡¡¡¡LogEvent(innerException.Message);
¡¡¡¡}
¡¡}
¡¡//ÈÕÖ¾¼Ç¼Àà
¡¡using System;
¡¡using System.Configuration;
¡¡using System.Diagnostics;
¡¡using System.IO;
¡¡using System.Text;
¡¡using System.Threading;
¡¡namespace MyEventLog
¡¡{
¡¡¡¡/// £¼summary£¾
¡¡¡¡/// ʼþÈÕÖ¾¼Ç¼À࣬ÌṩʼþÈÕÖ¾¼Ç¼֧³Ö
¡¡¡¡/// £¼remarks£¾
¡¡¡¡/// ¶¨ÒåÁË4¸öÈÕÖ¾¼Ç¼·½·¨ (error, warning, info, trace)
¡¡¡¡/// £¼/remarks£¾
¡¡¡¡/// £¼/summary£¾
¡¡¡¡public class ApplicationLog
¡¡¡¡{
¡¡¡¡¡¡/// £¼summary£¾
¡¡¡¡¡¡/// ½«´íÎóÐÅÏ¢¼Ç¼µ½Win2000/NTʼþÈÕÖ¾ÖÐ
¡¡¡¡¡¡/// £¼param name="message"£¾ÐèÒª¼Ç¼µÄÎı¾ÐÅÏ¢£¼/param£¾
¡¡¡¡¡¡/// £¼/summary£¾
¡¡¡¡¡¡public static void WriteError(String message)
¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡WriteLog(TraceLevel.Error, message);
¡¡¡¡¡¡}
¡¡¡¡¡¡/// £¼summary£¾
¡¡¡¡¡¡/// ½«¾¯¸æÐÅÏ¢¼Ç¼µ½Win2000/NTʼþÈÕÖ¾ÖÐ
¡¡¡¡¡¡/// £¼param name="message"£¾ÐèÒª¼Ç¼µÄÎı¾ÐÅÏ¢£¼/param£¾
¡¡¡¡¡¡/// £¼/summary£¾
¡¡¡¡¡¡public static void WriteWarning(String message)
¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡WriteLog(TraceLevel.Warning, message);¡¡¡¡
¡¡¡¡¡¡}
¡¡¡¡¡¡/// £¼summary£¾
¡¡¡¡¡¡/// ½«ÌáʾÐÅÏ¢¼Ç¼µ½Win2000/NTʼþÈÕÖ¾ÖÐ
¡¡¡¡¡¡/// £¼param name="message"£¾ÐèÒª¼Ç¼µÄÎı¾ÐÅÏ¢£¼/param£¾
¡¡¡¡¡¡/// £¼/summary£¾
¡¡¡¡¡¡public static void WriteInfo(String message)
¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡WriteLog(TraceLevel.Info, message);
¡¡
Ïà¹ØÎĵµ£º
ÔÚweb configÖÐ ×÷ÈçÏÂÅäÖãº
<connectionStrings>
<add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
ÔÚ.netÎļþÖÐÓ¦ÓÃÁ´½Ó ......
µ± ASP.NET ½ÓÊÕÕë¶ÔÒ³µÄÇëÇóʱ£¬Ëü´ÓÏ̳߳ØÖÐÌáȡһ¸öÏ̲߳¢½«ÇëÇó·ÖÅ䏸¸ÃÏ̡߳£
Ò»¸öÆÕͨµÄ£¨»òͬ²½µÄ£©Ò³ÔÚ¸ÃÇëÇóÆÚ¼ä±£ÁôỊ̈߳¬´Ó¶ø·ÀÖ¹¸ÃÏß³ÌÓÃÓÚ´¦ÀíÆäËûÇëÇó¡£Èç¹ûÒ»¸öͬ²½ÇëÇó³ÉΪ I/O bound£¨ÀýÈ磬Èç¹ûËüµ÷ÓÃÒ»¸öÔ¶³Ì Web ·þÎñ»ò²éѯһ¸öÔ¶³ÌÊý¾Ý¿â£¬²¢µÈ´ýµ÷Ó÷µ»Ø£©£¬ÄÇô·ÖÅ䏸¸ÃÇëÇóµÄÏß³ÌÔÚµ÷Ó÷µ»ØÖ®Ç°´ ......
ASP.NET ÅäÖýڼܹ¹°üº¬¿ØÖÆ ASP.NET Web Ó¦ÓóÌÐòÐÐΪµÄÔªËØ¡£Èç¹ûΪÊôÐÔÖ¸¶¨ÁËĬÈÏÖµ£¬Ôò¸ÃĬÈÏÖµÊÇÔÚ Machine.config ÎļþÖÐÉèÖõ쬏ÃÎļþµÄ·¾¶ÊÇ systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config¡£
<configuration>
<location>
......
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("£¼script£¾window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')£¼/script£¾")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attribute ......