|
-
Feb 25th, 2004, 03:36 PM
#1
Thread Starter
Hyperactive Member
Using Server.MapPath in windows app
I am trying to write a windows application .exe that uses Server.MapPath as I need to get the folder of a virtual directory.
I have added the System.Web reference to my project, but it still tells me that 'Server' cannot be found.
How can I get the path of a virtual directory in my vb.net windows app?
Greg
-
Feb 25th, 2004, 04:30 PM
#2
Addicted Member
Instead of server.mappath, rather try Application.StartupPath
Application.StartupPath will reference you to the project file that you are working in.
For example, if you are looking for a file in your bin folder:
strDatabase = Application.StartupPath & "\bin\Database.mdb"
hope i understood your question properly and are of some assistance.
If the facts don't fit the theory, change the facts. --Albert Einstein
-
Feb 25th, 2004, 04:41 PM
#3
Thread Starter
Hyperactive Member
No,
The problem is I need to detect 2 virtual directories on the PC. I need to get their physical path.
Application.Startup path won't help me because the directories will be elsewhere on the PC than the current application.
-
Feb 25th, 2004, 04:50 PM
#4
Addicted Member
ok, sorry for that.
i think i have a solution, but first... do you know the name of the folder or file that you are looking for?
If the facts don't fit the theory, change the facts. --Albert Einstein
-
Feb 25th, 2004, 04:59 PM
#5
Addicted Member
Ok, i have an idea. i've never tried it, but look in your MSDN search for IsolatedStorageFile.GetDirectoryNames
you can search for virtual directory and file paths... it's a nice little search.
good luck, let me know if it helps
If the facts don't fit the theory, change the facts. --Albert Einstein
-
Feb 25th, 2004, 05:50 PM
#6
The problem is that the windows app has no reference to the web context and thus no way of knowing which web its in (because its not in one). I'm assuming you are calling this exe from within website code. If so then pass the paths in as a commandline parameter then you can use Server.MapPath in the page and pass that info along.
-
Feb 26th, 2004, 05:10 AM
#7
Thread Starter
Hyperactive Member
Originally posted by Rockhopper
ok, sorry for that.
i think i have a solution, but first... do you know the name of the folder or file that you are looking for?
Yeah, the first folder name is Officium, the second folder name is OfficiumData
-
Feb 26th, 2004, 05:12 AM
#8
Thread Starter
Hyperactive Member
I was thinking of writing an app that starts from C: and checks if the folder exists, if not, then check if it exists on D: etc.
Then if I find it, I write the value to a .txt file or database for later reference.
Do you think this is a good idea?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|