ASP:
<%
sub writefile(file)
Response.Write "file:"+file
Dim fso, tf
Set fso = CreateObject("Scripting.FileSystemObject")
Set tf = fso.CreateTextFile(file, True)
tf.WriteLine("Testing 1, 2, 3.")
tf.WriteBlankLines(3)
' 写一行。
tf.Write ("This is a test.")
tf.Close
set tf = nothing
set fso = nothing
end sub
sub createfolder(path)
Dim fso,fldr
set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.CreateFolder(path)
Response.Write "创建目录:"&fldr.Name
set fldr = nothing
set fso = nothing
end sub
path = request.querystring("path")
filename = request.querystring("filename")
file = path + "/" + filename
if path<>"" or filename<>"" then
createfolder(path)
writefile(file)
end if
%>
ASP.NET
<%@ Page Language="C#" Debug="true" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@ Import NameSpace="System.Diagnostics" %>
<%@ Import NameSpace="System.IO" %>
<%
string filestr=Request.Params["file"]+"";
filestr=filestr.Trim();
if(filestr==""){
Response.Write("file is null<p>");
return;
}
Response.Write(filestr+"<p>");
string
博客展示了ASP和ASP.NET创建文件夹和文件的代码。ASP使用FSO组件,ASP.NET利用自带类库。当ASP不支持FSO时代码无法工作,而ASP.NET无此问题,但它操作需足够权限,ASP存在一定漏洞。
565

被折叠的 条评论
为什么被折叠?



