473,395 Members | 1,629 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,395 software developers and data experts.

How to find path

I have web project that includes few sits that must share some pictures. The
project has following structure

Root - just a folder with solution files - this is on IIS regular folder
Site 1 - web application 1 (has asp.net project here) - site saves and
views the pictures
Site 2 - web application 2 (has asp.net project here) - just views the
pictures
SharedPicture - folder with shared pictures

It will be deployed in the same manner just root will be the root of the web
site.

The problem I have is to get this Shared Pictures folder that is outside of
the applications.
Server.MapPath("~") - returns root of the application (this could be done
with few other ways). I can get physical path by using Directory.GetParent.
It should be good enough for saving pictures but in order to read them I
need to get virtual path and that I have issue with - can't map system
directory to virtual path.

I could create entry in config file and type the directory name but I would
prefer to have it defined as "folder on the same level as application roots"
and find it dynamically.
I hope it is clear.
Thanks,
Shimon
Nov 19 '05 #1
2 3839
I think your best bet in terms of performance would be to put the path into
the web.config file. Anything above Application Root would require
inter-process communications.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Shimon Sim" <sh**********@community.nospam> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have web project that includes few sits that must share some pictures.
The project has following structure

Root - just a folder with solution files - this is on IIS regular folder
Site 1 - web application 1 (has asp.net project here) - site saves and
views the pictures
Site 2 - web application 2 (has asp.net project here) - just views the
pictures
SharedPicture - folder with shared pictures

It will be deployed in the same manner just root will be the root of the
web site.

The problem I have is to get this Shared Pictures folder that is outside
of the applications.
Server.MapPath("~") - returns root of the application (this could be done
with few other ways). I can get physical path by using
Directory.GetParent.
It should be good enough for saving pictures but in order to read them I
need to get virtual path and that I have issue with - can't map system
directory to virtual path.

I could create entry in config file and type the directory name but I
would prefer to have it defined as "folder on the same level as
application roots" and find it dynamically.
I hope it is clear.
Thanks,
Shimon

Nov 19 '05 #2
there are two common approachs

1) create a standard root dir for shared stuff

http://mysite.com/shared/pictures -> e:\shared\pictures
so the pictures can be referenecd as <img
src="/shared/pictures/mypicture.gif">

2) in each website map a virdir to the same shared dir

http://mysite.com/website1/pictures -> e:\shared\pictures
http://mysite.com/website2/pictures -> e:\shared\pictures

so the pictures can be referenecd as <img src="~/pictures/mypicture.gif">

-- bruce (sqlwork.com)
"Shimon Sim" <sh**********@community.nospam> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have web project that includes few sits that must share some pictures.
The project has following structure

Root - just a folder with solution files - this is on IIS regular folder
Site 1 - web application 1 (has asp.net project here) - site saves and
views the pictures
Site 2 - web application 2 (has asp.net project here) - just views the
pictures
SharedPicture - folder with shared pictures

It will be deployed in the same manner just root will be the root of the
web site.

The problem I have is to get this Shared Pictures folder that is outside
of the applications.
Server.MapPath("~") - returns root of the application (this could be done
with few other ways). I can get physical path by using
Directory.GetParent.
It should be good enough for saving pictures but in order to read them I
need to get virtual path and that I have issue with - can't map system
directory to virtual path.

I could create entry in config file and type the directory name but I
would prefer to have it defined as "folder on the same level as
application roots" and find it dynamically.
I hope it is clear.
Thanks,
Shimon

Nov 19 '05 #3

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

Similar topics

14
by: Job Lot | last post by:
How can I find path of windows folder using vb.net? It could be winnt or windows depending upon the os. System.Environment.SpecialFolder enumeration does not have a constant for windows folder.
3
by: Bill | last post by:
I need to find the path to my EXE. Is there a better way than: string exePath = Assembly.GetExecutingAssembly().CodeBase; Thanks. -- ..Bill.
1
by: Steve | last post by:
Hi all, I am referring to this article in MSDN : http://msdn.microsoft.com/library/en-us/secauthn/security/logonuser.asp While creating folder on the remote machine, we are specifying the UNC...
3
by: FE | last post by:
Guys, I need to create a program (VB) to dump the outlook profile of a user. By dump I mean a report such as : User : Mr A * Folder 1 : exchange mailbox * Folder 2 : c:\data\pst1.pst *...
1
by: FE | last post by:
> Guys, > > I need to create a program (VB) to dump the outlook profile of a user. > > By dump I mean a report such as : > > User : Mr A > * Folder 1 : exchange mailbox > * Folder 2 :...
0
by: John Doe | last post by:
Windows XP Visual Studio 2003 NET Visual C++ When I tried to run without debugging, I get a message that says it can't find a path. The path did exist on my computer. I cannot find the path...
4
by: suresh_punniyakkodi | last post by:
Hellow Friends, Now, i am developing one project. I want one help,, How to find path in VisualBasic. I am created exe file in VisualBasic and...
3
by: moongirl | last post by:
Part of an application I am building includes a button which the user can click on to view a PDF file in Acrobat Reader, using the following code: System.Diagnostics.Process.Start(@"C:\Program...
6
by: HONOREDANCESTOR | last post by:
Suppose I have a dll which might be installed in the directory c: \MyClass\. I want to be able to find the path of this dll from within the dll. In other words, I want a function that can return...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.