ASP.NET中的例外情况“不支持给定路径的格式” [英] Exception in ASP.NET "The given path's format is not supported"
本文介绍了ASP.NET中的例外情况“不支持给定路径的格式”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我在asp.net上有一个关于FileUpload的问题。
C#代码是这样的:
Hi everybody.
I had a question about FileUpload in asp.net.
The C# code is like this:
imgUp.SaveAs(Server.MapPath("..")+@"/img/products/"+imgName);
执行时会发生以下异常:
不支持给定路径的格式
那么问题是什么?
我该怎么做才能纠正这个错误?
谢谢。
And when executing, this exception occurs:
The given path's format is not supported
So whats the problem with that?
What should i do to rectify this error?
Thanks.
推荐答案
尝试 imgUp.SaveAs(Server.MapPath(..)+ @\ img \ productcts \+ imgName);
这是因为imgName变量中使用了非法字符(用于文件名)。
It was because of the illegal characters(for file name) in the imgName variable that were used.
这篇关于ASP.NET中的例外情况“不支持给定路径的格式”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文