473,388 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Why I can not list the virtual directory?

I basically use the following code to display the directory and file names in
the WWWROOT, but can not show the virtual directory.
----
Dim path As String = Server.MapPath(x)
Dim di As DirectoryInfo = New DirectoryInfo(path)
Listing.DataSource = di.GetFileSystemInfos()
Listing.DataBind()
----
Anyone can help me about how to list the virtual directory.

Thanks

David
Nov 19 '05 #1
4 2930
Dim path As String = Server.MapPath("~") ' or "/" if you want the site root
Listing.DataSource = Directory.GetDirectories(path)
Listing.DataBind()

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #2
A Virtual Directory is a name not a physical location. The physical location
of your Virtual Directory can be anywhere on your hard drive. So the
physical location of your Virtual Directory isn't always
c:\inetpub\wwwroot\virtualdirectoryname

If you need to know the physical directories of all your IIS Virtual
Directories, look at the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W 3SVC\Parameters\Virtual
Roots

"david" <da***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
I basically use the following code to display the directory and file names
in
the WWWROOT, but can not show the virtual directory.
----
Dim path As String = Server.MapPath(x)
Dim di As DirectoryInfo = New DirectoryInfo(path)
Listing.DataSource = di.GetFileSystemInfos()
Listing.DataBind()
----
Anyone can help me about how to list the virtual directory.

Thanks

David

Nov 19 '05 #3
In
Dim path As String = Server.MapPath(x),
the x is relative path root. It works for real directory path within wwwroot.

David

"Brock Allen" wrote:
Dim path As String = Server.MapPath("~") ' or "/" if you want the site root
Listing.DataSource = Directory.GetDirectories(path)
Listing.DataBind()

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4
Thank you both of you.
I just created the virtual directory from IIS. If I set the property of
directory browsing, I can directly access to the directory virtually and get
anything I want from IE without my form based authentication. Now I try to
access it programatically without that setting and list the directory tree.
It works for others (not virtual one).

David

"gabe garza" wrote:
A Virtual Directory is a name not a physical location. The physical location
of your Virtual Directory can be anywhere on your hard drive. So the
physical location of your Virtual Directory isn't always
c:\inetpub\wwwroot\virtualdirectoryname

If you need to know the physical directories of all your IIS Virtual
Directories, look at the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W 3SVC\Parameters\Virtual
Roots

"david" <da***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
I basically use the following code to display the directory and file names
in
the WWWROOT, but can not show the virtual directory.
----
Dim path As String = Server.MapPath(x)
Dim di As DirectoryInfo = New DirectoryInfo(path)
Listing.DataSource = di.GetFileSystemInfos()
Listing.DataBind()
----
Anyone can help me about how to list the virtual directory.

Thanks

David


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Zenobia | last post by:
I copy an application to wwwroot: wwwroot +--- myApp +--- common | +--- images | default.asp global.asa
2
by: Jeffry van de Vuurst | last post by:
Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of you has some ideas about this. I'm using the...
5
by: Leszek | last post by:
Hello, Could anybody explain what's a difference between a virtual directory and an application root under IIS? I'm a little bit confused. This is mu problem: Let's assume the following...
1
by: Craig Burkett | last post by:
I have set up a virtual directory using IIS which points to a share on another machine. I want to be able to acquire a list of folders and/or files which exist in that share via the virtual...
2
by: Danny Miller | last post by:
Hi there, I'm facing a problem that is driving me nuts. The scenario is as follows: 1) Create an empty directory structure e.g. C:\Dev1\TestWebApp 2) Map a virtual directory e.g. TestWebApp...
2
by: Lucky | last post by:
Hello Guys, after long long time. i'm back again with some questions. right now i'm developing a code that fetch the list of websites from IIS 5.0 or later and also cretes the Virtual Directory...
6
by: ManagedCoder | last post by:
Hi, My requirement is as follows: I need to set the HttpExpires (enable content expiration - set to 7 days) on a folder within a virtual directory. I have been able to set the HttpExpires...
5
by: Ned White | last post by:
I have set up a virtual directory on ISS 6.0 to store the all .jpg and .swf files which i use in my project It is alias name is "OutSrc" Is it possible to acquire a list of files which exist in...
6
by: Scott M. | last post by:
I didn't get a resolution to this in my earlier post, so I'll try again: System: Windows XP Pro. (SP2) with IIS installed and running PRIOR to VS 2008 Pro. installation. VS 2008 Pro. (full...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.