µÚÈý¸öÀà,ÊÇÊý¾Ý¿âÁ¬½ÓÀà,Õâ¸ö¿ÉÒÔ¿´×öÊǸºÔð×îµ×²ãµÄÊý¾Ý¿â·ÃÎʵÄÒ»¸ö¶ÔÏó,²¢²»ÊôÓÚÊý¾Ý²ã. ËüÖ»ÊÇÒ»¸ö¹¤¾ß,¶ø²»Éæ¼°µ½ÈκιØÓÚÊý¾Ý¿âÄÚÈݵÄÂß¼.
ÔÙ´ÎÖØÉêÒ»ÏÂ,ÕâÈý¸öÀà,Ö»ÊÇÔÚASPÈý²ã¼Ü¹¹ÖеÄÈý´ó»ù±¾¶ÔÏó,ÏóÕâÖÖ¶ÔÏó,ÎÒÔÚ¾ßÌåµÄÒµÎñÖл¹Óиü¶àµÄÀ©Õ¹,ÀýÈç¶Ôfile²Ù×÷¶ÔÏó,excel²Ù×÷¶ÔÏó,mail¶ÔÏó,cookie¶ÔÏó...
ÕâЩ·â×°¹ÌÈ»¿´ÆðÀ´Ã»Ê²Ã´¼¼Êõº¬Á¿,¶øÇÒÒ²¿ÉÒÔ¼òµ¥µØÓú¯ÊýÀ´ÊµÏÖ,µ«ÊÇÔÚ´úÂë¹ÜÀí·½Ãæ,¾ÍÏÔµÃÁãÉ¢,ûÓб»ÓлúµØͳһ.
ͬһÀàÒµÎñ´¦Àí,·ÅÔÚͬһ×é¶ÔÏóÀïÃæ,¶ÔÏóÈçºÎʵÏÖ¾ßÌåµÄÒµÎñ²»ÓÃÍâÃæ¹ØÐÄ,Íâ½çÖ»ÐèҪͨ¹ý¶ÔÏóÕÒµ½·½·¨½øÐе÷ÓÃ,ÕâÊÇÃæÏò¶ÔÏóµÄ»ù´¡,Ò²ÊDZ¾ÏµÁеÄÈý²ã¼Ü¹¹µÄ»ù´¡,Ï£Íû´ó¼ÒÄÜÂýÂýÏ°¹ßÕâÖÖ·ç¸ñ.
ASPµÄÈý²ã¼Ü¹¹ÀïÃæËäÈ»×ö²»µ½´¦´¦½Ô¶ÔÏó,ÀýÈçÔÚUI²ãÀïÃæÈÔÈ»Êǽṹ»¯µÄÉè¼Æ,µ«ÊÇÉæ¼°µ½ÒµÎñÂß¼ºÍÊý¾Ý²Ù×÷,¾Í²»ÔÙÓ÷ÖÉ¢µÄfunction,sub,¶øÊÇÒ»¸ö¸ö¶ÔÏóÁË. ͨ¹ý¸÷ÖÖ¶ÔÏóÖ®¼äµÄ¹Øϵ,À´ÊµÏÖÈý²ã¼Ü¹¹.
ÒÀ¿¿¶ÔÏóÀ´²Ù×÷,ÊÇÈý²ã¼Ü¹¹µÄ»ù´¡,ËùÒÔÕâЩ»ù´¡º¯Êý,ÔÚÕâ¸ö¼Ü¹¹ÀïµÄ·â×°ÊDZØÒª ......
Win2003ÏÂAsp¡¢IISÅäÖü¼ÇÉ
¡¡¡¡windows 2003·ÛÄ«µÇ³¡£¬ºÜ¶à¸Ïʱ÷ÖµÄÓû§ÒѾÔç¾ÍÊÔÓÃÁË£¬µ«¾¡¹Ü2003ºÅ³Æ°²È«ÐÔÓкܴóÍ»ÆÆ£¬µ«ÆäĬÈÏÖ§³Ö.net¼Ü¹¹£¬¶øÅ×ÆúʹÓÃÁ˺ܾõĴóÖÚ»¯µÄAspµÄ·Ïßȱ±¥ÊÜÖÊÒÉ£¬ÐèÒªÎÒÃÇÊÖ¶¯È¥ÅäÖúܶණÎ÷¡£
¡¡¡¡ÔÚ IIS 6.0 ÖУ¬Ä¬ÈÏÉèÖÃÊÇÌرðÑϸñºÍ°²È«µÄ£¬ÕâÑù¿ÉÒÔ×î´óÏ޶ȵؼõÉÙÒòÒÔÇ°Ì«¿íËɵij¬Ê±ºÍÏÞÖƶøÔì³ÉµÄ¹¥»÷¡£±ÈÈç˵ĬÈÏÅäÖÃÊý¾Ý¿âÊôÐÔʵʩµÄ×î´ó ASP ÕÅÌù´óСΪ 204,800 ¸ö×Ö½Ú£¬²¢½«¸÷¸ö×Ö¶ÎÏÞÖÆΪ 100 KB¡£ÔÚ IIS 6.0 ֮ǰµÄ°æ±¾ÖУ¬Ã»ÓÐÕÅÌùÏÞÖÆ¡£µ¼ÖÂÎÒÃǵÄÓ¦ÓÃϵͳÍù2003ÒÆÖ²¾³£»á³ö´í¡£ÏÖ»ã×ܽâ¾ö·½°¸ÈçÏ¡£
Ò»¡¢ÆôÓÃAspÖ§³Ö
Windows Server 2003 ĬÈÏ°²×°£¬ÊDz»°²×° IIS 6 µÄ£¬ÐèÒªÁíÍâ°²×°¡£°²×°Íê IIS 6£¬»¹ÐèÒªµ¥¶À¿ªÆô¶ÔÓÚ ASP µÄÖ§³Ö¡£
µÚÒ»²½£¬ÆôÓÃAsp£¬½øÈ룺¿ØÖÆÃæ°å -> ¹ÜÀí¹¤¾ß ->IIS(Internet ·þÎñÆ÷)- Web·þÎñÀ©Õ¹ -> Active Server Pages -> ÔÊÐí
¿ØÖÆÃæ°å -> ¹ÜÀí¹¤¾ß ->IIS(Internet ·þÎñÆ÷)- Web·þÎñÀ©Õ¹ -> ÔÚ·þÎñ¶ËµÄ°üº¬Îļþ -> ÔÊÐí
µÚ¶þ²½,ÆôÓø¸Â·¾¶ ......
µÚ¶þ¸öÖØÒªµÄÀà,×÷ÓÃÊÇÀàÐÍת»»,ÀàÃûCon_Convert.ÔÚÒ³Ãæ´úÂëµÄ¿ªÍ·ÊµÀý»¯,¶ÔÏóÃûΪConvert,½èÓÃÁË.netµÄÀàÐÍת»»µÄ¶ÔÏóÃû³Æ.
Õâ¸öÀàÖ÷Òª½â¾öÔÚÀàÐÍת»»Ê±,Èç¹ûÖ±½ÓʹÓÃÀàÐÍת»»º¯Êý,»áÒòΪ±äÁ¿Îª¿Õ»òÕ߸ñʽ²»¶Ô¶øµ¼Ö³ÌÐò±¨´í,¶øÕâÖÖ±¨´íÔÚ´ó¶àÊýÇé¿öÏÂÊÇÔÊÐíµÄ.ÀýÈçҪת»»Ò»¸ö×Ö·û´®±äÁ¿ÎªÊý×Ö,Èç¹û±äÁ¿Îª¿Õ,ÔòÒ»°ãÐèÒª×Ô¶¯·µ»Ø0.
ÁíÍâÒ»¸öÖØÒª¹¦ÄܾÍÊÇ·â×°±äÁ¿¸ñʽ»¯²Ù×÷,¿ÉÒÔ±£³ÖÕû¸öÍøÕ¾µÄÊä³ö¸ñʽͳһ,ÀýÈçʱ¼ä¸ñʽ,»õ±Ò¸ñʽµÈµÈ. ÈÕÆںͻõ±Ò¸ñʽ»¯µÄʱºò,¼«Ò×Óöµ½Òò¿ÕÖµ±¨´íµÄÇé¿ö,Ò»°ã¶¼²»µÃ²»Ð´¸öÔ¤ÅжϿÕÖµµÄÂß¼,ÔÙ¸ñʽ»¯±äÁ¿. ʹÓÃÕâ¸öÀฺÔðÀàÐÍת»»ºÍ¸ñʽ»¯Êä³öºó,¾Í²»ÓòÙÐÄÕâЩËöËéµÄϸ½ÚÁË,¿ÉÒÔÈñà³ÌµÄÐÄÇéµÃµ½´ó´ó¸ÄÉÆ°¡.
»¹ÓÐЩÆäËû¸ñʽ»¯¹¦ÄÜ,Ò²¼ÓÁ˽øÈ¥,ÀýÈçConvert.ToPer()ÊÇÓÃÀ´×ª»»Êý×ֳɰٷÖÊý,Convert.FirstUppercase()ÓÃÀ´×öÊ××Öĸ´óд...... Äã¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèÒª,ËæʱÀ©Õ¹Õâ¸öÀà,²»ÒªÍü¼ÇÁ˺ʹó¼Ò·ÖÏíŶ.
ÓÐЩ»ù±¾µÄº¯Êý,Èç¹ûËæ±ãдһд,»ù± ......
<%
Response.Buffer = true
Response.Clear
dim url
Dim fso,fl,flsize
dim Dname
Dim objStream,ContentType,flName,isre,url1
Dim strFileName
strFileName=replace(replace(Request("file"),"\",""),"/","") '´«²Î
strFileName="/files/"&strFileName ' ¸Ä³ÉÄãÄãÎļþµÄ´æ·Å·¾¶
If strFileName<>"" Then
'******************************ÏÂÔØÎļþ´æ·ÅµÄ·þÎñ¶ËĿ¼
url=Server.MapPath(strFileName)
else
Response.Write("no found")
Response.end
End If
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadfromFile url
Select Case lcase(Right(flName, 4))
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
......
¿´µ½ÓÐÅóÓÑ˵ǰÃæÒ»Õ½²µÃû±ØÒª,ÏëÏëҲȷʵ.±¾À´ÊÇûÓдòËã½²ÕâЩ»ù´¡µÄ,Ö»ÊÇÐÐÎÄÆðÀ´Ã»ÓÐÔ¼Êø,¾Íµ´¿ªµ½»ù´¡ÖªÊ¶ÉÏÃæÁË.
´ÓÕâ½Ú¿ªÊ¼,½«»á¸ø´ó¼Ò½éÉÜASPÖеÄÈý´óͨÓÃÀà,Ëü¹á´©ÓÚÎÒËùÉè¼ÆµÄÈý²ã¼Ü¹¹ÖÐ,ÊǶÔASPÓï·¨µÄÀ©Õ¹,¿ÉÒÔÌá¸ßºÜ¶àϸ½Ú´¦ÀíÉϵÄЧÂÊ,¿ÉÒÔËãÊÇÒ»µãµã¿ò¼ÜµÄζµÀ.
±¾½Ú½éÉÜ´íÎó´¦ÀíÀà,ÀàÃûCon_Error,ÔÚ´úÂëÒ³ÃæÖ®³õ¾Í½øÐгõʼ»¯,ʵÀýÃûΪe,ÒÔϵÄe.add ¼´Ê¹ÓøôíÎóÀàµÄʵÀý»¯¶ÔÏó½øÐвÙ×÷.
·½·¨½éÉÜ:
e.Add(ByVal vErrorMessage ) ¼Ç¼һ¸ö´íÎó,²¢ÇÒÉèÖà e.Error = true . ÔÚ³ÌÐò¼ì²âÓû§ÃûºÏ·¨ÐԵȵط½·¢ÏÖ´íÎóʱ,¾Íµ÷ÓÃÕâ¸ö·½·¨,¼Ç¼һ¸ö´íÎóÐÅÏ¢.
ÀýÈç,Óû§µÇ½ʱÃÜÂë´íÎó,Ôòµ÷Óà e.add("ÄúµÄÕ˺ŻòÃÜÂë´íÎó") .Õâʱºò,´íÎó¶ÔÏóeÖбã¼Ç¼ÁËÒ»¸ö´íÎó,´íÎó¶ÔÏóµÄÊôÐÔe.Error=true .ÔÚºóÐø²Ù×÷ÖÐ,¿ÉÒÔʹÓôíÎó¶ÔÏóµÄÕâ¸öÊôÐÔ½øÐÐÅжÏ.
ÀýÈç:
³öÏÖ´íÎóºóµ¯³öС´°¿ÚÌáʾ´íÎó,²¢·µ»ØÇ°Ò»Ò³.
if e.Error then
&nbs ......
aspÏνÓMssqlµÄ°ì·¨¼°³£¼ûµÄ²î´í
//µÚÒ»ÖÖд·¨£º
MM_conn_STRING = "Driver={SQL Server};server=(local);uid=sa;pwd=;database=infs;"
Set conn = Server.Createobject("ADODB.Connection")
conn.open MM_conn_STRING
SET RS=SERVER.CreateObject("ADOBD.recordset")
SQL="SELECT * from TABLE ORDER BY ID DESC"
RS.open SQL,CONN,3,3
//µÚ¶þÖÖд·¨£º£¨DSNÏνӣ©
MM_conn_STRING="DSN=BBS;UID=SA;PWD=12345"
Set conn = Server.Createobject("ADODB.Connection")
conn.open MM_conn_STRING
SET RS=SERVER.CreateObject("ADOBD.recordset")
SQL="SELECT * from TABLE ORDER BY ID DESC"
RS.open SQL,CONN,3,3 // 3,3ÊǸĶ¯¡¢É¾³ý¡¢ÔöÌí¿ª¹Ø£¡
//µÚÈýÖÖд·¨£º
MM_conn_STRING_own = "Driver={SQL Server};server=(local);uid=sa;pwd=11111;database=infs;"
Set conn = Server.Createobject("ADODB.Connection")
conn.open MM_conn_STRING_own
//µÚËÄÖÖ - ÕâÖÖ·½Ê½ÓÃÔÚACCESSÖÐ
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" _
& Server.MapPath("asp.mdb")
set conn = server.createobject("adodb.connection" ......