|
|
|
start date: Tue, 31 Jul 2007 19:18:04 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Jeff Beem
|
|
2
Eliyahu Goldin
|
|
3
Jeff Beem
|
|
4
Jeff Beem
|
|
5
Eliyahu Goldin
|
physical path to virtual path under virtual directory
Best way I can think to describe this is through an example. I have a
virtual directory, let's call it "MyVirtualDirectory" that maps to
\\MyServer\Shared.
I have a path that is \\MyServer\Shared\SomeDirectory\SomeFile.txt.
I need to convert this path to a virtual path with the virtual directory
name. The result I'm after would be:
MyVirtualDirectory\SomeDirectory\SomeFile.txt
Any help would be greatly appreciated.
Date:Tue, 31 Jul 2007 19:18:04 -0700
Author:
|
Re: physical path to virtual path under virtual directory
What about
myPhysicalPath.Replace(Request.MapPath(Request.ApplicationPath), "");
?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" wrote in message
news:7E5FB1DE-E9E3-49DA-9E5A-F8125438058E@microsoft.com...
> Best way I can think to describe this is through an example. I have a
> virtual directory, let's call it "MyVirtualDirectory" that maps to
> \\MyServer\Shared.
>
> I have a path that is \\MyServer\Shared\SomeDirectory\SomeFile.txt.
>
> I need to convert this path to a virtual path with the virtual directory
> name. The result I'm after would be:
>
> MyVirtualDirectory\SomeDirectory\SomeFile.txt
>
> Any help would be greatly appreciated.
Date:Wed, 1 Aug 2007 15:36:30 +0300
Author:
|
Re: physical path to virtual path under virtual directory
Sorry, but that won't do. My web site can have one or more virtual
directories which are mapped to file storage locations. I need the path to
have the name of the virtual directory under which the file lives as the
first part of the path. The site itself is not a virtual directory.
Thanks
"Eliyahu Goldin" wrote:
> What about
>
> myPhysicalPath.Replace(Request.MapPath(Request.ApplicationPath), "");
>
> ?
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Jeff Beem" wrote in message
> news:7E5FB1DE-E9E3-49DA-9E5A-F8125438058E@microsoft.com...
> > Best way I can think to describe this is through an example. I have a
> > virtual directory, let's call it "MyVirtualDirectory" that maps to
> > \\MyServer\Shared.
> >
> > I have a path that is \\MyServer\Shared\SomeDirectory\SomeFile.txt.
> >
> > I need to convert this path to a virtual path with the virtual directory
> > name. The result I'm after would be:
> >
> > MyVirtualDirectory\SomeDirectory\SomeFile.txt
> >
> > Any help would be greatly appreciated.
>
>
>
Date:Wed, 1 Aug 2007 07:40:03 -0700
Author:
|
Re: physical path to virtual path under virtual directory
My previous reply was a little off. The site 'can be' under a virtual
directory but I'm not interested in that path. I'm interested in the virtual
directories 'within' the site.
"Eliyahu Goldin" wrote:
> What about
>
> myPhysicalPath.Replace(Request.MapPath(Request.ApplicationPath), "");
>
> ?
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Jeff Beem" wrote in message
> news:7E5FB1DE-E9E3-49DA-9E5A-F8125438058E@microsoft.com...
> > Best way I can think to describe this is through an example. I have a
> > virtual directory, let's call it "MyVirtualDirectory" that maps to
> > \\MyServer\Shared.
> >
> > I have a path that is \\MyServer\Shared\SomeDirectory\SomeFile.txt.
> >
> > I need to convert this path to a virtual path with the virtual directory
> > name. The result I'm after would be:
> >
> > MyVirtualDirectory\SomeDirectory\SomeFile.txt
> >
> > Any help would be greatly appreciated.
>
>
>
Date:Wed, 1 Aug 2007 07:44:03 -0700
Author:
|
Re: physical path to virtual path under virtual directory
You can't tell the virtual directory by the physical path.
But, if you know the list of all your virtual directories, you can loop
through the list and use the MapPath method to match virtual and physical
directories.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" wrote in message
news:6F228E57-BD00-4D0F-9188-B5F4413ECFC2@microsoft.com...
> My previous reply was a little off. The site 'can be' under a virtual
> directory but I'm not interested in that path. I'm interested in the
> virtual
> directories 'within' the site.
>
> "Eliyahu Goldin" wrote:
>
>> What about
>>
>> myPhysicalPath.Replace(Request.MapPath(Request.ApplicationPath), "");
>>
>> ?
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "Jeff Beem" wrote in message
>> news:7E5FB1DE-E9E3-49DA-9E5A-F8125438058E@microsoft.com...
>> > Best way I can think to describe this is through an example. I have a
>> > virtual directory, let's call it "MyVirtualDirectory" that maps to
>> > \\MyServer\Shared.
>> >
>> > I have a path that is \\MyServer\Shared\SomeDirectory\SomeFile.txt.
>> >
>> > I need to convert this path to a virtual path with the virtual
>> > directory
>> > name. The result I'm after would be:
>> >
>> > MyVirtualDirectory\SomeDirectory\SomeFile.txt
>> >
>> > Any help would be greatly appreciated.
>>
>>
>>
Date:Wed, 1 Aug 2007 17:59:55 +0300
Author:
|
|
|