473,320 Members | 1,612 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,320 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 3961
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.