Click here to Skip to main content
15,791,602 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:
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 = Nothing
                   Return ReturnVar
               End If

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

Give me a idea pls

Thanks in advance


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

Replace line,

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


"Dim FS As FileStream = New FileStream(Server.MapPath("~//Temp//" & filename), FileMode.Create)"
Share this answer
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 :
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