AspÖÐÒþ²ØÏÂÔØµØÖ·
<%
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"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".bmp"
ContentType = "image/bmp"
Case ".ppt"
ContentType = "application/vnd.ms-powerpoint"
Case ".mdb"
ContentType = "application/x-msaccess"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html" ,"htm(1)"
ContentType = "text/html"
Case ".txt"
ContentType = "text/plain"
Case Else
ContentType = "application/octet-stream"
End Select
' ÎÒÊÇÓÃUPload×é¼þÉÏ´«µÄ,Èç¹ûÖØÃû»á²úÉú"(Êý×Ö)" ºó׺,
' ÓÐЩÖ÷»ú»á×èÖ¹ÏÂÔØÕâÀàÎļþ,ËùÒÔÕâÀï¼ÓÒ»¸ö¼ì²é,½«Upload×é¼þ×Ô¶¯Éú³ÉµÄºó׺
If InStr(lcase(Right(flName, 1)),")") Then
flName=mid(flName,1,Len(flName)-3)
End If
Response.AddHeader "Content-Disposition", "attachment; filename=" &
Ïà¹ØÎĵµ£º
¿Í»§¶Ë´úÂ룺
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Ê ......
¸Õµ÷ÊÔ³ÌÐòµÄʱºò±¨´íºóÈ»ºóÕҵĽâ¾ö·½·¨£¬ÏÖÔÚ·¢³öÀ´´ó¼Ò½è¼ø¡£
-----------------------
´íÎóÌáʾ£º
ÔËÐÐʱ´íÎó 800a01b6
¶ÔÏó²»Ö§³Ö´ËÊôÐÔ»ò·½·¨: Response.CharSet
---------------------------------------------------------------------
(°Ù¶Èһϣ¬»¹ÓкܶàÈËÓöµ½Í¬ÑùµÄ´íÎó)
Micros ......
ASP.NETÖеÄÉí·ÝÑéÖ¤(authentication)ÓÐÄÄЩ
=========================================
FormsÉí·ÝÑéÖ¤£º
ͨ¹ýÆä¿É½«Ã»ÓÐͨ¹ýÉí·ÝÑéÖ¤µÄÇëÇóÖØ¶¨Ïòµ½Ê¹Óà HTTP ¿Í»§¶ËÖØ¶¨ÏòµÄ HTML ´°ÌåµÄϵͳ¡£Óû§Ìṩƾ
¾Ý²¢Ìá½»¸Ã´°Ìå¡£Èç¹ûÓ¦ÓóÌÐòÑéÖ¤¸ÃÇëÇó£¬ÏµÍ³¾Í»á·¢³ö°üº¬Æ¾¾Ý»òÃÜÔ¿µÄ Cookie ÒÔÖØÐ»ñÈ¡¸Ã±êʶ
¡£ºóÐøµÄ ......
ASP¡£NETÖй²Óм¸ÖÖÀàÐ͵Ŀؼþ
========================================
Á½ÖÖ£º
1. ¿Í»§¶Ë¿Ø¼þ£¬Ò²¾ÍÊÇÎÒÃÇÔÚHTMLÖо³£Óõ½µÄ
2. ·þÎñ¶Ë¿Ø¼þ£¬ÀýÈç: <asp:TextBox ID="txt" runat="server" />
¿Í»§¶Ë¿Ø¼þÒ²¿ÉÒÔת³É·þÎñ¶Ë¿Ø¼þ
<input type="text" id="txt" runat="server" />
HTML ºÍ WEB
ASP¡£NET ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
Response.Buffer = True '»º´æÍ¼Æ¬
Dim objXMLHTTP, XML
Set XML = Server.CreateObject("Microsoft.XMLHTTP") '½¨Á¢ÏÂÔØ¶ÔÏó
XML.Open "GET","http://www.google.cn/images/nav_logo7.png",False '¿ªÊ¼»ñȡͼƬ,http://xxx/pngÕâ½Ú¿ÉÒԸijÉ× ......