Getting list of the files from a virtual directory

  • Thread starter Thread starter Ned White
  • Start date Start date
N

Ned White

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,
 
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 said:
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 said:
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,
 
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 said:
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 said:
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 said:
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


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,
 
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 said:
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 said:
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 said:
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


message 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


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,
 
Back
Top