473,378 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Path.GetFullPath and ":"

I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its argument
contains a ":". If GetFullPath behaved this way I would not be able to use it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of date?

Thanks in advance for any help,
Mark Urish

Jul 21 '05 #1
3 3964
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the
MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its
argument
contains a ":". If GetFullPath behaved this way I would not be able to use
it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but
returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed
to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of
date?

Thanks in advance for any help,
Mark Urish

Jul 21 '05 #2
Thanks for your response.

The msdn doc I am referring to is:

http://msdn.microsoft.com/library/de...lpathtopic.asp

In the the Exceptions section:
Exception Type Condition
NotSupportedException: path contains a colon (":").
"Ben Lucas" wrote:
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the
MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its
argument
contains a ":". If GetFullPath behaved this way I would not be able to use
it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but
returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed
to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of
date?

Thanks in advance for any help,
Mark Urish


Jul 21 '05 #3
Interesting. Well, given the test I ran yesterday, I would assume that it
means if the path contains a ":" after the first "\", which would be a bad
path, but again, in testing yesterday, using a full path returned a full
path without throwing any exceptions.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com...
Thanks for your response.

The msdn doc I am referring to is:

http://msdn.microsoft.com/library/de...lpathtopic.asp

In the the Exceptions section:
Exception Type Condition
NotSupportedException: path contains a colon (":").
"Ben Lucas" wrote:
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full
path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
>I want to make sure that a filename is an "absolute path" (ie. has a
>drive
> spec. and root, or else is a UNC path) if it isn't already one.
> Path.GetFullPath seems to do the trick, except there is one thing in
> the
> MSDN
> documentation that makes me nervous.
>
> MSDN says that GetFullPath will throw NotSupportedException if its
> argument
> contains a ":". If GetFullPath behaved this way I would not be able to
> use
> it
> because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
> excpetion. Instead, I find that it does not throw an exception, but
> returns
> "D:\file.ext" as I would like.
>
> Does anyone know which behavior is correct? Is Path.GetFullPath
> supposed
> to
> throw an exception if its argument contains a ":"? Or, is it that a ":"
> in
> the pathname now supported in .NET 1.1 and the documentation is out of
> date?
>
> Thanks in advance for any help,
> Mark Urish
>


Jul 21 '05 #4

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

Similar topics

2
by: Karl Koscher | last post by:
I'm trying to communicate with a USB device using C#. I'm able to determine the device path using P/Invoke and SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces, and SetupDiGetDeviceInterfaceDetail,...
10
by: Alpha | last post by:
I use FolderBrowserDlg for user to select a folder path then store it in the sql table. I then retrieve it to concatenate in a sqlcommand text to retrive files from that directory but it won't...
1
by: ±ù÷¢ | last post by:
I have a standard vb crystal reports viewer control on a web form with just the one simple report bound to it. when I run the project I get the following error: ACCESS TO THE PATH...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
1
by: Michiel Schaeverbeke | last post by:
Hi, I'm trying to reach an xml file from within a web application. The file is physically on a different server. When I try to reach it using \\servername\path\ style, I get the error...
0
by: haylow | last post by:
Hi I am new to ASP.NET and am working on an application that runs on a webserver. The user will open up the web interface in a browser on their local machine and enter a path to a directory. I...
9
by: Clinton Frankland | last post by:
Hi, On a Windows 2000 Server when attempting to use System.IO.Directory.CreateDirectory(string.concat(Server.MapPath(""), "\verify")) I receive a System.IO.DirectoryNotFoundException error:...
0
by: awbacker | last post by:
Havin a problem with MapPath() failing on me. It doesn't do it right away, but at some point it dies and won't come back. I have to hiccup the app by poking IIS or a web.config/other critical...
3
by: Eckhard Schwabe | last post by:
I only found one post on Google where someone mentions the same problem with a DataSet: XmlDataReader in .Net 1.1 can not read XML files from a path which contains "%10" or "%3f". code to...
2
by: job | last post by:
In a sharepoint setup using smartpart to load our user controls using enterprise blocks (data) we are getting some strange errors (logged to the event log). We dont get the error all the time. When...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.