Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting list of the files from a virtual directory

0 views
Skip to first unread message

Ned White

unread,
May 5, 2008, 7:01:47 PM5/5/08
to
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 that virtual
directory ?

For my default project directory, i can get list of the specific files like
that;
*******************
DirectoryInfo drc = new DirectoryInfo("~/banners");
FileInfo[] FileLst = drc.GetFiles("*.swf");
*******************
But, how about for the virtaul directory, Is there a way to do this?

Thanks,


Eliyahu Goldin

unread,
May 6, 2008, 4:23:20 AM5/6/08
to
You can always convert a virtual path to the physical one with the MapPath
method. After this you can use the same DirectoryInfo calls.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Ned White" <nedwhite@> wrote in message
news:u7RYYQwr...@TK2MSFTNGP06.phx.gbl...

Ned White

unread,
May 6, 2008, 6:13:43 AM5/6/08
to
Hi Eliyahu ,

The physical path of my OutPic virtual directory is "C:\Media\Banners" and
if i use
DirectoryInfo sf = new DirectoryInfo(Server.MapPath("OutPic"));
It returs "'c:\inetpub\wwwroot\defaultsite\OutPic"
but the real physical path is "C:\Media\Banners" and the virtual path
is"'c:\inetpub\wwwroot\OutPic"

Sorry bu i don't understand that how can i convert the virtual path to
physical with MapPath ?
Thanks


"Eliyahu Goldin" <REMOVEALLCAPIT...@mMvVpPsS.org> wrote in
message news:O1AdkK1r...@TK2MSFTNGP06.phx.gbl...

Patrice

unread,
May 6, 2008, 6:50:59 AM5/6/08
to
Is this OutPic or OutSrc as you named it in IIS according to your first post
?

What is the output for Server.MapPath("~/OutSrc") ?

--
Patrice

"Ned White" <nedwhite@> a écrit dans le message de groupe de discussion :
efkO$H2rIH...@TK2MSFTNGP05.phx.gbl...

Ned White

unread,
May 6, 2008, 7:16:30 AM5/6/08
to
ohh sory for the mistake,
Yes Patrice, u are right, the "OutPic" is must be "OutSrc" .
the alias name of the virtual directory is "OutSrc" .
output of the Server.MapPath("~/OutSrc") is
"c:\\inetpub\\wwwroot\\defaultsite\\OutSrc"

"defaultsite" is the default project site. That's why if i use
Server.MapPath in my project it returns value for the project site, and it
puts
"defaultsite" before the OutSrc.


"Patrice" <http://www.chez.com/scribe/> wrote in message
news:6CA9F99D-F1CF-431B...@microsoft.com...

Eliyahu Goldin

unread,
May 6, 2008, 9:14:04 AM5/6/08
to
There is an override of MapPath method for HttpRequest that take 3
parameters:
http://msdn.microsoft.com/en-us/library/3z2189ck.aspx

I have never used it myself, just wondering if you can get any use of it.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Ned White" <nedwhite@> wrote in message

news:uutjFr2...@TK2MSFTNGP04.phx.gbl...

0 new messages