Converting absolute path to relative

dotnet framework

    Next

  • 1. Invalid file name for monitoring
    Hi! I have an application that runs great under framework 1.0 but when I upgrated it to framework 1.1 I started to get the following error: Invalid file name for monitoring: 'c:\inetpub\wwwroot\MyApp\http:'. File names for monitoring must have absolute paths, and no wildcards. System.Web.HttpException: Invalid file name for monitoring: 'c:\inetpub\wwwroot\VR\http:'. File names for monitoring must have absolute paths, and no wildcards. The strange thing about it is that the error only comes when I search in a database and I populate-ing a couple of ascx pages. My application uses the microsoft.web.ui.webcontrols but I'm not sure wheather that is the reason or what! I found out that when I reached the following line in my code then the error was thrown: _args.AdditionalInfo = System.Configuration.ConfigurationSettings.AppSettings["Member"]; so I threw out all of the Configsetting in web.config file, but that does not seem to matter at all! the exception thrown at the end of the function that searches for the member. I could save the application by telling the app to run under the framework 1.0, but now I have to use the 1.1 but Im stuck. Can anyone help me, please I'm not in the posistion to rewrite the application! Best regards VEV
  • 2. filesystemwatcher on 98
    Is there any way to use filesystemwatcher on windows 98/me? Any workaround to write a software that uses it on win2K/xp and some other solution on 98/me? I need to receive an event when a new file is created. thanks
  • 3. Exception Handling and Loops
    Hi, I have a while loop where for each value I execute a database query. I have a situation where one of these queries abort due to bad data. I want the application to continue processing the loop for other values. I have tired what I thought would do this but it still aborts the application on error. I have a Manager class that has the while loop that calls a Data class that fromulates the parameters and the the right stored proc and that calls the MS. Data Access application block to execute the query The block of code in the manager class looks like this SqlDataReader drIDs = GetInformation(); while (drIDs.Read()) { int iId = drIDs.GetInt32(0); try { GenerateReport(iId); } catch (Exception e) { throw; continue; } } The error I get is .Net SQL Client Data Provider. Subquery returned more than one value. How do I skip the error and continue processing the loop for other values. TIA
  • 4. Chicken and egg problem with FileIOPermission and Environment.GetFolderPath("My Documents")
    Hello, I am trying to assert a FileIOPermission to get access to the "My Documents" folder. To do this, I am using this code: FileIOPermission FilePathPerm = new FileIOPermission(FileIOPermissionAccess.AllAccess, Environment.GetFolderPath(Environment.SpecialFolder.Personal)); The problem I'm running into is that the code above throws a permissions acception. GetFolderPath method requires FileIOPermission to the path is is returning before it can return anything. So, it can't be used to return the path permissions are being requested for. So, how do I accomplish this task of requesting permissions for "My Documents" when I don't know ahead of time what the full path to "My Documents" is and I can't get access to it through the GetFolderPath method? Is there an environment variable or something that would hold this value? Thanks, Phred

Converting absolute path to relative

Postby Dmitry Shaporenkov » Sat, 27 Sep 2003 01:55:49 GMT

Hi,

assume I have two paths referring to files on the same 
logical volume, like "C:\Home\Dir1\file1.txt" 
and "C:\Home\Dir2\file2.txt". How can I convert the 
second absolute path to a relative path based on the 
first one, like "..\Dir2\file2.txt"? I'm looking into the 
System.IO.Path class but can't find an answer...

Thanks in advance,
Dmitry

Similar Threads:

1.How to chage Absolute url to relative url ,and relative url to absolute url

How to chage Absolute url to relative url ,and relative 
url to absolute url

2.why relative hint path but absolute reference path

I have a vs.net 2002 solution that contains a number of projects
All projects are created in folders under the solution folder.
The idea here is that this entire solution should be 'moveable' ie. copied
to and useable from a new directory or computer.
And it almost is.

One project makes reference to an existing .net dll that also exists in a
folder under the solution folder.
The project file shows a relative hint path to the dll ie
"..\..\dllFolder\my.dll"
If I move the solution to a new folder and the open solution from the new
location, the dll can no longer be found.  if i restore the original
solution folder, the dll is once again found.  so obviously, although the
project file includes a relative hint path, vs.net is in fact looking for
the dll at an absolute location.  This is causing headaches as this solution
cannot be 'passed around'  without re-adding the reference to this dll.

is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references - is
there some trick using a dummy project to get this to work ?

gerry



3.Get machine name path from relative or absolute path

Hello, is it possible in C#.Net to get a path to a file in the form
"\\Spain\Madrid\readme.txt" from a relative path i.e "readme.txt" or
from a absolute path in the following form "C:\Madrid\readme.txt" where
"Spain" is the name of the machine that the file is on? Thanks in
advance.

4.absolute path to relative path conversion

5.why relative hint path but absolute reference path

I have a vs.net 2002 solution that contains a number of projects
All projects are created in folders under the solution folder.
The idea here is that this entire solution should be 'moveable' ie. copied
to and useable from a new directory or computer.
And it almost is.

One project makes reference to an existing .net dll that also exists in a
folder under the solution folder.
The project file shows a relative hint path to the dll ie
"..\..\dllFolder\my.dll"
If I move the solution to a new folder and the open solution from the new
location, the dll can no longer be found.  if i restore the original
solution folder, the dll is once again found.  so obviously, although the
project file includes a relative hint path, vs.net is in fact looking for
the dll at an absolute location.  This is causing headaches as this solution
cannot be 'passed around'  without re-adding the reference to this dll.

is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references - is
there some trick using a dummy project to get this to work ?

gerry






6. Absolute or Relative path?

7. Relative & absolute path question (JavaScript, mostly)

8. User controls --> Relative/Absolute Paths



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 89 guest