473,785 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetPa rent.
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 3856
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**********@c ommunity.nospam > wrote in message
news:%2******** *******@TK2MSFT NGP12.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.GetPa rent.
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\pictu res
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\pictu res
http://mysite.com/website2/pictures -> e:\shared\pictu res

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

-- bruce (sqlwork.com)
"Shimon Sim" <sh**********@c ommunity.nospam > wrote in message
news:%2******** *******@TK2MSFT NGP12.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.GetPa rent.
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
18351
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
5099
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
2235
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 path as per the example. But we get this error "could not find a part of the path". we are prefixing the path with @ symbol and also tried with the escaping the "\\".
3
1816
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 * Folder 2 : c:\data\pst2.pst
1
5724
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 > * Folder 2 : c:\data\pst2.pst
0
1344
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 text (my search criteria is only one word from the path) in the solution or anywhere on my computer. Here is the error when I try to run without debugging, after
4
4614
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 placed in to any where, Ex: abc.exe. This file is placed in any where in my system.. I want that file path at time of execution of that abc.exe file. Regards,
3
5265
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 Files \Adobe\Reader 8.0\Reader\AcroRd32.exe", @PDFfilePath); However the path to acrobat reader is the path on my PC - what if the path is different on the user's PC? How can I change the code to find
6
2927
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 "c: \MyClass". I cannot use Application.GetExecutablePath from within the dll, because that gives me the path of the application that is calling the dll. This question was also asked on this forum back in 2002, and Microsoft had no answer to...
0
9485
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8986
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.