473,406 Members | 2,378 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,406 software developers and data experts.

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.
Aug 1 '07 #1
4 8699
What about

myPhysicalPath.Replace(Request.MapPath(Request.App licationPath), "");

?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" <Je******@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.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.

Aug 1 '07 #2
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.App licationPath), "");

?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" <Je******@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.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.


Aug 1 '07 #3
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.App licationPath), "");

?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" <Je******@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.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.


Aug 1 '07 #4
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" <Je******@discussions.microsoft.comwrote in message
news:6F**********************************@microsof t.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.Ap plicationPath), "");

?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jeff Beem" <Je******@discussions.microsoft.comwrote in message
news:7E**********************************@microso ft.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.



Aug 1 '07 #5

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

Similar topics

2
by: Scott Tilton | last post by:
We have a field that gets filled into a database that our ASP website pulls from. What we would like to be able to do is to take that path and convert it to a virtual path so the website can...
2
by: Simon | last post by:
I wonder if someone can help with this - I 'm creating an IISVirtualDirectory, and setting its Path property to the physical path I want to reference. This works fine when I have a standard file...
0
by: jimmy | last post by:
Hoping someone can help. I've setup several FTP shares on IIS 5, where some of the shares are located on another computer, while other directories are on the local computer. Is there a...
1
by: Michiel Schaeverbeke | last post by:
Hi, I'm trying to reach an xml file from within a web application. The file is physically on a different server. When I try to reach it using \\servername\path\ style, I get the error...
2
by: Yoshitha | last post by:
Hi I am developing an application in which am using the windows application template. In one of the form i'll place a text box control and a button control, if i entered the virtual directory...
5
by: marss | last post by:
Server.MapPath("~/page.aspx") returns the physical file path based on the specified virtual path. Is there any reverse method to get the virtual path based on the physical path (both pathes belong...
2
by: Jex | last post by:
Hi, I hv create an application using C#, Asp.Net (VS 2005) and I add an Installer Class to that application's setup (when deploy that app), so that I can change the version to 2.0, Now, I need...
4
by: Paul F | last post by:
Im confused about the difference(s) between virtual directories and physical directories in IIS. Any ideas? *** Sent via Developersdex http://www.developersdex.com ***
3
by: =?Utf-8?B?UGF1bCBIYXRjaGVy?= | last post by:
I have a setup with two web applications, call them parent and child where child is web application held virtual underneath parent though not physically. What I'd like to be able to do is write...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.