Monday, March 26, 2012

MapPath fails

My ASP.Net 2.0 page (VB) is failing when trying to use the MapPath method on
a virtual directory that contains a comma and a period (see below), but I'm
not sure why as those are acceptable characters for a folder name. How can
I get ariound that? Thanks.

strFilePath = "Documents/File090217/0005ComputerPackages, Inc."

strFilePathPhy = HttpContext.Current.Server.MapPath(strFilePath)

DavidThat's probably because it seems illegal to have a folder name that
ends with a .

Try creating a folder with a name that ends with a . , or renaming one
to end with a . Windows ignores the full stop!

On Fri, 17 Nov 2006 15:10:07 -0600, "David" <dlchase@.lifetimeinc.com>
wrote:

Quote:

Originally Posted by

>My ASP.Net 2.0 page (VB) is failing when trying to use the MapPath method on
>a virtual directory that contains a comma and a period (see below), but I'm
>not sure why as those are acceptable characters for a folder name. How can
>I get ariound that? Thanks.
>
>strFilePath = "Documents/File090217/0005ComputerPackages, Inc."
>
>strFilePathPhy = HttpContext.Current.Server.MapPath(strFilePath)
>
>
>David
>


--

Bits.Bytes.
http://bytes.thinkersroom.com
Also - when you say it fails, exactly what is happening?
if you're adding a filename to it, at some point - try adding a slash to the
end of the directory (strFilePath)

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"David" <dlchase@.lifetimeinc.comwrote in message
news:O$lTIzoCHHA.4832@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

My ASP.Net 2.0 page (VB) is failing when trying to use the MapPath method


on

Quote:

Originally Posted by

a virtual directory that contains a comma and a period (see below), but


I'm

Quote:

Originally Posted by

not sure why as those are acceptable characters for a folder name. How


can

Quote:

Originally Posted by

I get ariound that? Thanks.
>
strFilePath = "Documents/File090217/0005ComputerPackages, Inc."
>
strFilePathPhy = HttpContext.Current.Server.MapPath(strFilePath)
>
>
David
>
>

0 comments:

Post a Comment