|
-
Dec 22nd, 2004, 11:25 AM
#1
Thread Starter
Frenzied Member
How to get folder name
How do you determine what folder you are in?
For instance, say you have a website with a few folders like this (only an example):
www.MyWebsite.com/Cars/Imports/Volkswagen/
What code will return the current folder, in this case, Volkswagen?
~Peter

-
Dec 22nd, 2004, 12:42 PM
#2
Re: How to get folder name
 Originally Posted by MrGTI
How do you determine what folder you are in?
For instance, say you have a website with a few folders like this (only an example):
www.MyWebsite.com/Cars/Imports/Volkswagen/
What code will return the current folder, in this case, Volkswagen? 
Use Serever.MapPath(FolderPath_Or_FilePath)
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Dec 22nd, 2004, 01:56 PM
#3
Thread Starter
Frenzied Member
Re: How to get folder name
I'm afraid that isn't what i was looking for. I want to get back the folder, without having to tell it what folder i'm in.
~Peter

-
Dec 22nd, 2004, 02:29 PM
#4
PowerPoster
Re: How to get folder name
Code:
Dim x As DirectoryInfo = Directory.GetParent(Server.MapPath(Request.ServerVariables("SCRIPT_NAME")))
Label1.Text = x.Name
-
Dec 22nd, 2004, 03:19 PM
#5
Thread Starter
Frenzied Member
Re: How to get folder name
After i added Imports System.IO to the top of the page, that code worked fine. Thanks veryjonny.
I see it uses the Server.MapPath that Danial mentioned, only with a little more code to get the desired results!
~Peter

-
Dec 22nd, 2004, 03:29 PM
#6
PowerPoster
Re: How to get folder name
I am sorry, i forgot to mention the imports stm
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
|