Click here to Skip to main content
15,072,483 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I've got an error: "Illegal characters in path." But i don't understand why ?

The code is:
VB
Dim FS As FileStream = New FileStream(Server.MapPath("~/Temp/" & filename), FileMode.Create)
                   blobMail = CType(TableContainer.Rows(0).Item(0), Byte())
                   FS.Write(blobMail, 0, blobMail.Length)
                   FS.Close()
                   FS = Nothing
                   Return ReturnVar
               End If



even if i give ("../temp/") also geting same error

Give me a idea pls

Thanks in advance

Velsamy
Posted

Have a look at this: Removing characters which are not allowed in Windows filenames[^] - the chances are that filenamecontains something unexpected...
   
Hi,

Replace line,

C#
"Dim FS As FileStream = New FileStream(Server.MapPath("~/Temp/" & filename), FileMode.Create)"


with

C#
"Dim FS As FileStream = New FileStream(Server.MapPath("~//Temp//" & filename), FileMode.Create)"
   
Comments
avelsamy 21-Apr-14 5:10am
   
still didnt work , Mr.bhagesh
avelsamy 21-Apr-14 5:53am
   
also didnt work , i cant able to figured out.... give me another idea pls
Bh@gyesh 21-Apr-14 5:56am
   
Refer link :
http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames
avelsamy 21-Apr-14 6:32am
   
still no ....
Bh@gyesh 21-Apr-14 6:35am
   
Do one thing,
1) Debug your application.
2) Add "FS" variable in watch.
3) see the value of FS runtime and check wether the path is correct or not?

if possible paste your path here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900