在网址中列出文件 [英] list file in a url address
本文介绍了在网址中列出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
兄弟
我有一个url,例如:www.site.com,地址如下:
www.site.com/ask
www.site.com/home
.
.
.
.
我想提供主要地址,它也给了我这些文件(询问,回家,....).
hi bro
i have a url , example : www.site.com and The address is as follows:
www.site.com/ask
www.site.com/home
.
.
.
.
I want to give the main address And it gives me these files (ask,home,....).
推荐答案
您无法浏览以下文件系统您想要的任何网站.大多数站点和服务器都处于锁定状态,以防止出于安全原因而执行此操作.
You can''t browse the filesystem of any website you want like that. Most sites and servers are locked down tight to prevent you from doing this for security reasons.
您要执行以下操作:
You want to do this:
string host = string.Format("http://{0}", HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);
编辑=============
如果只需要文件名,则可以执行以下操作:
EDIT =============
If you want just the filename, you can do this:
string filename = System.IO.Path.GetFileName(System.Web.HttpContext. Current.Request.Url.AbsolutePath);
为什么要进行1票表决?如果您要这样做,至少要礼貌地告诉我原因.
Why was this 1-voted? If you''re gonna do that, at least do me the courtesy of telling me why.
这篇关于在网址中列出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文