当前位置:首页 > 服务器 > 正文

asp查看服务器服务器目录(asp文件怎么查看)

本篇文章给大家谈谈asp查看服务器服务器目录,以及asp文件怎么查看对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

ASP.NET获取服务器目录的几个方法

编写程序的时候,经常需要用的项目根目录。自己总结如下

1、取得控制台应用程序的根目录方法

方法1、Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径

方法2、AppDomain.CurrentDomain.BaseDirectory 获取基目录,它由程序集冲突解决程序用来探测程序集

2、取得Web应用程序的根目录方法

方法1、HttpRuntime.AppDomainAppPath.ToString();//获取承载在当前应用程序域中的应用程序的应用程序目录的物理驱动器路径。用于App_Data中获取

方法2、Server.MapPath("") 或者 Server.MapPath("~/");//返回与Web服务器上的指定的虚拟路径相对的物理文件路径

方法3、Request.ApplicationPath;//获取服务器上ASP.NET应用程序的虚拟应用程序根目录

3、取得WinForm应用程序的根目录方法

1、Environment.CurrentDirectory.ToString();//获取或设置当前工作目录的完全限定路径

2、Application.StartupPath.ToString();//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称

3、Directory.GetCurrentDirectory();//获取应用程序的当前工作目录

4、AppDomain.CurrentDomain.BaseDirectory;//获取基目录,它由程序集冲突解决程序用来探测程序集

5、AppDomain.CurrentDomain.SetupInformation.ApplicationBase;//获取或设置包含该应用程序的目录的名称

其中:以下两个方法可以获取执行文件名称

1、Process.GetCurrentProcess().MainModule.FileName;//可获得当前执行的exe的文件名。

2、Application.ExecutablePath;//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称

asp如何查看服务器根目录下特定的子文件夹,然后显示这个特定文夹中的内容,并能下载这些内容

解释详细一些啊..根目录指的是磁盘根目录 还是public_html?

----

..我看分数好多以为是要读磁盘根目录

既然是网站根目录那么这个文件夹就会有other 的read权限啊

剩下就是如何调用函数的问题了,你可以用FSO

小旋风asp服务器的文件目录在哪了?

一般默认是在C盘的WWWROOT,你可以打开IIS看看,其实任意的目录都可以的,设置主目录就可以了!

asp获取服务器一目录下的所有图片的文件名

%

'以下为修改内容

Const UploadDir="/picture/" '存放文件的目录

Const Up="/picture/" '存放文件的目录

Const MaxPerPage=30 '每页显示数量

const Webpage="时尚网页图片" '标题

'检查组件是否已经安装

Function IsObjInstalled(strClassString)

IsObjInstalled = False

Err = 0

Dim xTestObj

Set xTestObj = Server.CreateObject(strClassString)

If 0 = Err Then IsObjInstalled = True

Set xTestObj = Nothing

Err = 0

End Function

dim strFileName

dim totalPut,CurrentPage,TotalPages

dim TruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize

strFileName="?"

if request("page")"" then

currentPage=cint(request("page"))

else

currentPage=1

end if

TruePath=Server.MapPath(UploadDir)

If not IsObjInstalled("Scripting.FileSystemObject") Then

Response.Write "bfont color=red你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能/font/b"

Else

set fso=CreateObject("Scripting.FileSystemObject")

if fso.FolderExists(TruePath)then

FileCount=0

TotleSize=0

Set theFolder=fso.GetFolder(TruePath)

For Each theFile In theFolder.Files

FileCount=FileCount+1

TotleSize=TotleSize+theFile.Size

next

totalPut=FileCount

if currentpage1 then

currentpage=1

end if

if (currentpage-1)*MaxPerPagetotalput then

if (totalPut mod MaxPerPage)=0 then

currentpage= totalPut \ MaxPerPage

else

currentpage= totalPut \ MaxPerPage + 1

end if

end if

if currentPage=1 then

showContent

showpage2 strFileName,totalput,MaxPerPage

response.write "brdiv align='center'本页共显示 b" FileCount-1 "/b 个图片,占用 b" TotleSize\1024 "/b K/div"

else

if (currentPage-1)*MaxPerPagetotalPut then

showContent

showpage2 strFileName,totalput,MaxPerPage

response.write "brdiv align='center'本页共显示 b" FileCount-1 "/b 个图片,占用 b" TotleSize\1024 "/b K/div"

else

currentPage=1

showContent

showpage2 strFileName,totalput,MaxPerPage

response.write "brdiv align='center'本页共显示 b" FileCount-1 "/b 个图片,占用 b" TotleSize\1024 "/b K/divbrbr"

end if

end if

else

response.write "找不到文件夹!可能是配置有误!"

end if

end if

sub showContent()

dim c

FileCount=1

TotleSize=0

%

TABLE cellSpacing=5 cellPadding=5 border=0

TBODY

TR bgColor=#ffffff

% For Each theFile In theFolder.Files

c=c+1

if FileCountMaxPerPage then

exit for

elseif cMaxPerPage*(CurrentPage-1) then %

TD align=middle width="138"

img src=%=(UploadDir theFile.Name)% border=0br

%

dim str

str=""(theFile.Name)""

str1=str

str2=str

str=replace(str,".jpg","")

if instr(1,str,"/")0 then

str=split(str,"/")

str1=str(0)

end if

%%=str%

/td

% if FileCount mod 5 =0 then%

/TR

TR bgColor=#ffffff

%end if%

% FileCount=FileCount+1

TotleSize=TotleSize+theFile.Size

end if

Next

%

/tr/TBODY/table

%

end sub

sub showpage2(sfilename,totalnumber,maxperpage)

dim n, i,strTemp

if totalnumber mod maxperpage=0 then

n= totalnumber \ maxperpage

else

n= totalnumber \ maxperpage+1

end if

strTemp= "TABLE cellSpacing=1 cellPadding=1 border=0 align='center'TR bgColor=#ffffffform name='showpages' method='Post' action='" sfilename "'td align='center'"

strTemp=strTemp "共 b" totalnumber "/b 个图片 "

if CurrentPage2 then

strTemp=strTemp "首页 上一页 "

else

strTemp=strTemp "a href='" sfilename "page=1'首页/a "

strTemp=strTemp "a href='" sfilename "page=" (CurrentPage-1) "'上一页/a "

end if

if n-currentpage1 then

strTemp=strTemp "下一页 尾页"

else

strTemp=strTemp "a href='" sfilename "page=" (CurrentPage+1) "'下一页/a "

strTemp=strTemp "a href='" sfilename "page=" n "'尾页/a"

end if

strTemp=strTemp " 页次:strongfont color=red" CurrentPage "/font/" n "/strong页 "

strTemp=strTemp " b" maxperpage "/b" "个图片/页"

strTemp=strTemp " 转到:select name='page' size='1' onchange='javascript:submit()'"

for i = 1 to n

strTemp=strTemp "option value='" i "'"

if cint(CurrentPage)=cint(i) then strTemp=strTemp " selected "

strTemp=strTemp "第" i "页/option"

next

strTemp=strTemp "/select"

strTemp=strTemp "/td/form/tr/table"

response.write strTemp

end sub

%

asp查看服务器服务器目录的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于asp文件怎么查看、asp查看服务器服务器目录的信息别忘了在本站进行查找喔。

取消
扫码支持 支付码