路径中的非法字符。 [英] Illegal characters in path.

查看:533
本文介绍了路径中的非法字符。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我收到错误:路径中的字符非法。但我不明白为什么?



代码为:

  Dim  FS  As  FileStream =  FileStream(Server.MapPath( 〜/ Temp /& filename),FileMode.Create)
blobMail = CType (TableContainer.Rows( 0 )。项目( 0 ), Byte ())
FS.Write(blobMail, 0 ,blobMail.Length )
FS.Close()
FS = 没什么
返回 ReturnVar
结束 如果







即使我给( ../temp/)也有同样的错误



给我一个想法请



谢谢提前



Velsamy

解决方案

看看这个:删除Windows文件名中不允许的字符 [ ^ ] - 很有可能 filename 包含意外的内容......






替换line,



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





with



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


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.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

解决方案

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


Hi,

Replace line,

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



with

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


这篇关于路径中的非法字符。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆