473,624 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get current folder path?

Hi,

I am developing an asp.net application. I have create
some class method and I would like to get the folder path
of that class method. I cannot use this.Mappath("" ) to get
the path because it is not a type of *.aspx.cs. I try to
use System.Environm ent.CurrentDire ctory() but it return
c:\winnt\system 32 when I use
System.Web.Http Context.Current .Server.MapPath ("") it
returns path from the aspx file that call the class method.

I hope someone can help me on my problem.

Chung

Nov 18 '05 #1
1 13689
System.Assembly .Location will give you the file system path to the assembly.
The assembly itself sits in the bin directory of the application root, which
you can also get. The cs file exists only in development. (Well, you could
copy it to production, but that's not a good idea.)

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Chung" <an*****@hotmai l.com> wrote in message
news:08******** *************** *****@phx.gbl.. .
Hi,

I am developing an asp.net application. I have create
some class method and I would like to get the folder path
of that class method. I cannot use this.Mappath("" ) to get
the path because it is not a type of *.aspx.cs. I try to
use System.Environm ent.CurrentDire ctory() but it return
c:\winnt\system 32 when I use
System.Web.Http Context.Current .Server.MapPath ("") it
returns path from the aspx file that call the class method.

I hope someone can help me on my problem.

Chung

Nov 18 '05 #2

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

Similar topics

8
3977
by: Salad | last post by:
I designed a small app and I wanted to do a BrowseFolder (see http://www.mvps.org/access/api/api0002.htm), basically do a file open diaglog and select a directory/folder. The problem is that you can't specify the starting folder. Stephan Leban provided a neat solution that does allow me to browse using a starting folder. I am using A97 and it works fine. However, I put it onto a system that uses AccessXP. And it chokes on...
5
8107
by: MattG | last post by:
Can someone point me towards something explaining how to overwrite an exe that is currently being executed, if even possible? I'm trying to build in an update routine to ahve it look for a newer version of itself on the network and then copying that new version on itself... of course I keep getting an IOException because the file is 'In use by another Process' Thanks a bunch,
3
6148
by: Nick | last post by:
VB.Net allows the ability to find the path of special folders by calling the System.Environment.GetFolderPath function with a parameter specifying which special folder I want the path of. Unfortunately, it doesn't appear to allow finding special folders related to "All Users". For example, I am trying to determine the "All Users Start Menu" folder but am only able to find the "Start Menu" folder for the current user. How is it...
3
1872
by: News | last post by:
Does anyone know how to get the file spec of DLL from within the code? I thought that System.Reflection.GetExecutingAssembly() would work, but it returns the name of the program that called DLL routine, not the DLL file itself. Mike Buchanan
1
3607
by: Simon | last post by:
Dear Access friends, How can I load a string with his own folder address. The following code addressed to the system folder of MS programs.
1
1347
by: preet | last post by:
i tried to find tutorials to build a working tree menu from contents of current folder but was unable to find any, neither did i find any working scrit to build on can anyone suggest something i am a newbie to javascript but i did manage to come up with something using filesystemobject Set fso = Server.CreateObject("Scripting.FileSystemObject")
0
1468
by: Renatebhp | last post by:
While using CurDir to get the current path where my open workbook is located, I get a result that's short of the current folder.e.g. the path to the file is C:\FolderLv1\FolderLv2\FolderLv3\Myfile.xls And CurDir returns: C:\FolderLv1\FolderLv2 This creates a problem when trying to open the next xls file in the same folder. Can anyone help? Here is the code: Private Sub ConsolidationButton_Click()
1
1424
by: The Mad Ape | last post by:
Hello I have a FileSave Dialog and am trying to pass the current folder name to a string. Is there any way to do that? It was easy to get the file path and name using .FileName but I see nothing to get the Folder. Thanks The Mad Ape
8
5206
by: Mateusz Viste | last post by:
Hi, I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)... I recently put the following script online: <script type="text/javascript"><!-- function playmedia(mediafile) { newwindow=window.open(); if (window.focus) {newwindow.focus()} newwindow.document.write('<html>');
0
8238
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
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...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7164
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...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
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.