473,659 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MapPath invalid character error

Hi,
I'm trying to use MapPath on a folder named with a comma in it:

xmldoc.load Server.MapPath( Request.QuerySt ring("fname"))

where the querysting is something like "fname=this , that/this, that.xml".

I'm sure it's the comma, because if I remove it and rename the file
and folder, everything works.
I believe that a comma is a valid character in a folder or filename,
so why does MapPath barf on it?
Is there any way around this still using MapPath?
Can someone point me to a source with a list of the valid characters
the MapPath accepts?

Thanks,
Supertzar

Jul 19 '05 #1
4 5603
http://www.aspfaq.com/2302


"Supertzar" <Su*******@BS.i nvalid> wrote in message
news:mc******** *************** *********@4ax.c om...
Hi,
I'm trying to use MapPath on a folder named with a comma in it:

xmldoc.load Server.MapPath( Request.QuerySt ring("fname"))

where the querysting is something like "fname=this , that/this, that.xml".

I'm sure it's the comma, because if I remove it and rename the file
and folder, everything works.
I believe that a comma is a valid character in a folder or filename,
so why does MapPath barf on it?
Is there any way around this still using MapPath?
Can someone point me to a source with a list of the valid characters
the MapPath accepts?

Thanks,
Supertzar

Jul 19 '05 #2
Hi Supertzar,

From my research it looks like this is a known issue, Microsoft has
known for years, but no fix is available.

What you'll have to do is break the path down in code and only do
Server.MapPath on the portion you know is safe.

What I had was a file name for which I needed to know the absolute
path on my disk, so I did this:
strFullPath = Server.MapPath( ".") & "\" & strMyFileNameWi thCommas

Hope this helps.
David

Supertzar <Su*******@BS.i nvalid> wrote in message news:<mc******* *************** **********@4ax. com>...
Hi,
I'm trying to use MapPath on a folder named with a comma in it:

xmldoc.load Server.MapPath( Request.QuerySt ring("fname"))

where the querysting is something like "fname=this , that/this, that.xml".

I'm sure it's the comma, because if I remove it and rename the file
and folder, everything works.
I believe that a comma is a valid character in a folder or filename,
so why does MapPath barf on it?
Is there any way around this still using MapPath?
Can someone point me to a source with a list of the valid characters
the MapPath accepts?

Thanks,
Supertzar

Jul 19 '05 #3
I'm having the same issue. My filename contains a
comma. Have you found a workaround using server.mappath?

Steve
-----Original Message-----
http://www.aspfaq.com/2302


"Supertzar" <Su*******@BS.i nvalid> wrote in message
news:mc******* *************** **********@4ax. com...
Hi,
I'm trying to use MapPath on a folder named with a comma in it:
xmldoc.load Server.MapPath( Request.QuerySt ring ("fname"))
where the querysting is something like "fname=this , that/this, that.xml".
I'm sure it's the comma, because if I remove it and rename the file and folder, everything works.
I believe that a comma is a valid character in a folder or filename, so why does MapPath barf on it?
Is there any way around this still using MapPath?
Can someone point me to a source with a list of the valid characters the MapPath accepts?

Thanks,
Supertzar

.

Jul 19 '05 #4
> I'm having the same issue. My filename contains a
comma. Have you found a workaround using server.mappath?


This article might help...
http://www.aspfaq.com/2302
Jul 19 '05 #5

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

Similar topics

0
2814
by: Lopa | last post by:
I get an error "006~ASP 0173~Invalid Path Character~An invalid character was specified in the Path parameter for the MapPath method.", while using the Server.Mappath function. but i have not been able to figure out what all characters could lead to this error. Does MS have any list of such characters not allowed, or can anyone give me such a list of characetrs?
6
10494
by: Dan Sikorsky | last post by:
How do you use server.mappath to update a access database on a completely different computer? One of my websites needs to update a database on a completely different website. Example: My ASP page is on http://www.websiteone.com and I want to update the database on http://www.websitetwo.com // where is the Access database?
7
14373
by: A P | last post by:
I receive an error like this: Server.MapPath() error 'ASP 0172 : 80004005' Invalid Path /conn.asp, line 2 The Path parameter for the MapPath method must be a virtual path. A physical path was used.
3
19778
by: Kaidi | last post by:
Hello guys, I get the "an invalid XML character" error when using xerces to parse a XML file. I know that XML will correspond the &, <, >, " to special strings like "&gt;&lt;". However, how about if the XML file really needs to contain some text like: "&#x3;&#x4;&#x14;&#x8;&#x8;"? (as content of a tag) The story is: I am writing a program to parse some XML files from another program. In that program, it graps webpages, and saves the pages'...
0
662
by: majiofpersia | last post by:
Hi all, I am confused the mappath does not support virtual directories any more? I realize that the ".." for the virtual directory to go to a higher level root is not supported in .NET any longer ... but I can't get the mappath to work with the backslash/forwardslash/ and no-slash to work either ... I have tried pretty much every combination ... any ideas as what I am doing wrong is appreciated ... Here is what I am trying to achieve ......
0
1190
by: Martin Pahlplatz | last post by:
When I use server.mappath("a,b") IIS returns the following message: 'Error Type: Server.MapPath(), ASP 0173 (0x80004005) An invalid character was specified in the Path parameter for the MapPath method.' Is there a workaround to enable use of mappath for a folder with a comma in its name?
1
10149
by: King Kong | last post by:
we are facing this kind of error when we double click the infragistic web grid please help me on this Regards Moid Iqbal Server Error in '/NetworkAccess' Application. ---------------------------------------------------------------------------- ----
0
3321
by: =?Utf-8?B?YWptZWhyYQ==?= | last post by:
I am trying to save a file to c:\inetpub\wwwroot\temp and I am using this code ln 1 For Each objFile In objUpload.Files ln 2 objFile.SaveAs(Server.MapPath("/temp/") & objFile.Name) ln 3 Next I end up getting an error on ln 2: System.ArgumentException: Invalid path for MapPath 'c:\'. A virtual path is expected.
1
2363
by: =?Utf-8?B?UGF1bCBQaGlsbGlwcw==?= | last post by:
I have read many things about this but I haven't got a clear vision on what to do if anything about this. I have a system that tries to find holes in my web site. One of the things it has found and has been sent to me is an Invalid_Viewstate exception. I will provide the stack trace below. If you read down the stack trace it talks about "Invalid chararcter in a base-64
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
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
7360
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...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.