|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在实现ERP等高端的ASP应用时,用户需要提供核心的经营资料,需要ASP商有很高的信用度。楼上说交互性不好,太牵强了吧。在微软提供的一套框架中,利用asp做网站,开发效率高,使用人数少,减少不必要的开销。交互性是互动方式,是有开发人员决定的。<%
Sitevalidator1.0.0
Verysimpleconcept,runthisscriptonyourserver,itrecordsthefiledetailstoan
XMLfilewhichyoudownloadandstore.Then,whenyoucomebacktomakechangesyoucan
runtheXMLfilebackthroughthisscriptanditwilltellyouifanyofthefileshave
beenmodified.Quitesimplereally.
RequiresXMLparserversion3toworkreally.AlsoneedsaccesstotheFileSystemObject.
DimobjRequest,objFSO,sXML,objXML,objNode,objFile,lDifferences,sVersion,sDate
sVersion="1.0.0"
Response.Expires=-1
SetobjRequest=NewProxyRequest
ifUCase(objRequest("action"))="UPLOAD"then
Response.ContentType="text/html"
%>
<HTML>
<HEAD>
<TITLE>ASPValidate,Sitevalidator<%=sVersion%></TITLE>
</HEAD>
<BODY>
<h1>ASPValidate,Sitevalidator<%=sVersion%></h1>
<h2>Author:ChrisRead(<ahref="mailtmrjolly@bigpond.net.au">Mail</a>,<ahref="http://users.bigpond.net.au/mrjolly.">Web</a>)</h2>
<p>Validationresults</p>
<%
SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")
SetobjXML=Server.CreateObject("MSXML2.DOMDocument")
objXML.async=False
sXML=objRequest("xmlupload")
objXML.loadXMLobjRequest.ASCIIToUNICODE(sXML)
lDifferences=0
NowwegothroughtheXMLentriesandvalidateeachoneagainstthatontheserver
ForEachobjNodeinobjXML.documentElement.childNodes
onerrorresumenext
SetobjFile=objFSO.GetFile(objNode.getAttribute("path"))
iferr.number0then
Problemwiththefile
Response.Write"<b>"
Response.WriteobjNode.getAttribute("path")&"<br>"
Response.Write"^^^^FILEHASBEENREMOVED<br>"
Response.Write"</b>"
else
ifCStr(objFile.DateLastModified)objNode.getAttribute("modified")orCStr(objFile.Size)objNode.getAttribute("size")then
Response.Write"<b>"
Response.WriteobjNode.getAttribute("path")&"<br>^^^^Changed,"
Response.Write"original:"&objNode.getAttribute("modified")&"modified:"&objFile.DateLastModified&","
Response.Write"was"&objNode.getAttribute("size")&"bytes-now"&CStr(objFile.Size)&"bytes<br>"
Response.Write"</b>"
lDifferences=lDifferences+1
elseifobjRequest("view")""then
Response.WriteobjNode.getAttribute("path")&"-Filehasnotchanged<br>"
endif
endif
onerrorgoto0
Next
iflDifferences=0then
Response.Write"<p>Thesitematchesthelastupdate</p>"
else
Response.Write"<p>"&lDifferences&"difference(s)detectedintheabovefiles</p>"
endif
%>
<ahref="aspvalidate.asp">Backtothemainpage</a>
</BODY>
</HTML>
<%
Response.End
elseifUCase(objRequest.QueryString("action"))="XML"then
SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")
sXML="<?xmlversion=1.0?>"&vbCRLF
sXML=sXML&"<!--GeneratedbySiteValidator"&sVersion&"-->"&vbCRLF
sXML=sXML&"<!--Author:ChrisRead-->"&vbCRLF
sXML=sXML&"<site>"&vbCRLF
sXML=sXML&ProcessFolder(Server.MapPath("/"))
sXML=sXML&"</site>"&vbCRLF
sDate=Year(Date())&"-"&Month(Date())&"-"&Day(Date())
Response.ContentType="text/xml"
Response.AddHeader"Content-Disposition","attachment;filename=site"&sDate&".xml;"
Response.WritesXML
Response.End
else
Response.ContentType="text/html"
%>
<HTML>
<HEAD>
<TITLE>ASPValidate,Sitevalidator<%=sVersion%></TITLE>
</HEAD>
<BODY>
<h1>ASPValidate,Sitevalidator<%=sVersion%></h1>
<h2>Author:ChrisRead(<ahref="mailtmrjolly@bigpond.net.au">Mail</a>,<ahref="http://users.bigpond.net.au/mrjolly.">Web</a>)</h2>
<h3>Itvalidatessites</h3>
<p>Thisscriptwillscanyourentirewebsitefromtherootfolder,andrecordthefilesizesandlastmodifieddatesforallASPpages.
ThisissavedasXML.Then,atalaterdate,whenyouneedtomakeadjustmentsorcheckanything,youcanloadtheXMLinto
thisscriptagainanditlltellyouwhichfileshavechangedandwhen.</p>
ChecksumallASPfilesonthissiteandgenerateanXMLchecksumfile<br>
<ahref="aspvalidate.asp?action=xml&html=0">Right-clickhereandselect"SaveAs"todownloadforASPfilesonly</a><br>
<ahref="aspvalidate.asp?action=xml&html=1">Right-clickhereandselect"SaveAs"todownloadforASPandHTMLfiles</a><br>
<formaction="aspvalidate.asp"method="post"enctype="multipart/form-data"id=form1name=form1>
<br>OR<br><br>
UploadXMLFileofchecksumsandvalidateitagainstthissite<br>
File:<inputtype=filename=xmlupload><br>
Showallresults:<inputtype=checkboxname=view><br>
<inputtype=submitname=actionvalue="Upload">
</form>
</BODY>
</HTML>
<%
Response.End
endif
BitofrecursiontotraversethefolderstructurebuildingXML
FunctionProcessFolder(sFolder)
DimobjFolder,objRoot,objFile,sTemp,sLastModified,sSize
SetobjRoot=objFSO.GetFolder(sFolder)
sTemp=""
ForEachobjFileinobjRoot.Files
if(Right(objFile.Name,4)=".asp"or((Right(objFile.Name,5)=".html"orRight(objFile.Name,4)=".htm")andRequest("html")=1))andinstr(sFolder&""&objFile.Name,"_vti_cnf")=0then
sLastModified=objFile.DateLastModified
sSize=objFile.Size
sTemp=sTemp&"<filepath="&sFolder&""&objFile.Name&"modified="&sLastModified&"size="&sSize&"/>"&vbCRLF
endif
Next
ForEachobjFolderinobjRoot.SubFolders
sTemp=sTemp&ProcessFolder(sFolder&""&objFolder.Name)
Next
SetobjFolder=Nothing
ProcessFolder=sTemp
EndFunction
Requesobjectproxyforuploads.
ClassProxyRequest
PublicClientCertificate
PublicCookies
PublicForm
PublicQueryString
PublicServerVariables
PublicTotalBytes
Privatem_Item
PublicDefaultPropertyGetItem(sIndex)
Item=m_Item(sIndex)
EndProperty
PrivatesBinaryText
PublicFunctionBinaryRead(lTotalBytes)
BinaryRead=LeftB(sBinaryText,lTotalBytes)
EndFunction
PrivateSubParseRequest()
DimsDelimeter
DimlKeyLength
DimlBlockEnd
DimsBlock
DimsTemp
DimsField
DimlStart
DimlLength
DimsFilename
DimsContentType
DimsContent
sBlock=sBinaryText
lKeyLength=InstrB(1,sBlock,ChrB(&H0D))-1
iflKeyLength>0then
sDelimeter=LeftB(sBlock,lKeyLength)
lBlockEnd=0
whilelBlockEnd>=0
Chopoffthekey,includingtheCR/LFpair
sBlock=RightB(sBlock,LenB(sBlock)-(lBlockEnd+lKeyLength+2))
lBlockEnd=InStrB(1,sBlock,sDelimeter)-1
iflBlockEnd>=0then
sTemp=LeftB(sBlock,lBlockEnd-2)
lStart=InStrB(1,sTemp,UNICODEToASCII("name="))+6
lLength=InStrB(lStart,sTemp,ChrB(34))-lStart
sField=MidB(sTemp,lStart,lLength)
lStart=InStrB(1,sTemp,UNICODEToASCII("filename="))+10
lLength=InStrB(lStart,sTemp,ChrB(34))-lStart
iflStart>10then
sFilename=MidB(sTemp,lStart,lLength)
lStart=InStrB(1,sTemp,UNICODEToASCII("Content-Type:"))+14
lLength=InStrB(lStart,sTemp,ChrB(&H0D))-lStart
sContentType=MidB(sTemp,lStart,lLength)
else
sFilename=""
sContentType=""
endif
lStart=InStrB(1,sTemp,UNICODEToASCII(vbCRLF&vbCRLF))+4
lLength=LenB(sTemp)-lStart+1
sContent=MidB(sTemp,lStart,lLength)
ifASCIIToUNICODE(sFilename)""then
m_Item.AddASCIIToUNICODE(sField),sContent
m_Item.AddASCIIToUNICODE(sField)&"_filename",ASCIIToUNICODe(sFilename)
m_Item.AddASCIIToUNICODE(sField)&"_contenttype",ASCIIToUNICODE(sContentType)
else
m_Item.AddASCIIToUNICODE(sField),ASCIIToUNICODE(sContent)
endif
endif
wend
endif
EndSub
PublicFunctionUNICODEToASCII(sText)
DimlTemp
DimobjStream
SetobjStream=Server.CreateObject("ADODB.Stream")
objStream.Open
ForlTemp=1ToLen(sText)
objStream.WriteTextChrB(Asc(Mid(sText,lTemp,1)))
Next
objStream.Position=0
UNICODEToASCII=objStream.ReadText
EndFunction
PublicFunctionASCIIToUNICODE(sText)
Dothiswiththestream,avoidingVBScriptstringconcatenation,whichisslowtosaytheleast
DimlTemp
DimobjStream
SetobjStream=Server.CreateObject("ADODB.Stream")
objStream.Open
ForlTemp=1ToLenB(sText)
objStream.WriteTextMidB(sText,lTemp,1)&ChrB(0),0
Next
objStream.Position=0
ASCIIToUNICODE=objStream.ReadText
EndFunction
PrivateSubClass_Initialize()
Setm_Item=Server.CreateObject("Scripting.Dictionary")
SetClientCertificate=Request.ClientCertificate
SetCookies=Request.Cookies
SetForm=Request.Form
SetQueryString=Request.QueryString
SetServerVariables=Request.ServerVariables
TotalBytes=Request.TotalBytes
sBinaryText=Request.BinaryRead(Request.TotalBytes)
ParseRequest
EndSub
PrivateSubClass_Terminate()
SetClientCertificate=Nothing
SetCookies=Nothing
SetForm=Nothing
SetQueryString=Nothing
SetServerVariables=Nothing
EndSub
EndClass
%>
实现规模效益。与传统的用户拥有硬件软件所有权和使用权以及传统的应用服务商提供一对一的服务模式不同,ASP拥有应用系统所有权,用户拥有使用权,应用系统集中放在ASP的数据中心中,集中管理,分散使用,以一对多的租赁的形式为众多用户提供有品质保证的应用技术服务,实现规模效益。 |
|