由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - Windows filesystem bug
相关主题
System.Data.SqlClient.SqlException: A network-related or instance -specific errorWebClient is not thread-safe!
easy question, but ...LinqPad is handy
新手问个问题哈,关于C#的Newbie ASP.NET question
a question about C++.net class librarynHibernate mapping question
[合集] 问一个Response.WriteFile的问题How not to read comment lines from a text file
C#的new在method declaration里有和没有有啥区别么error .mdf file unable to attach in Visual Studio 2013 win (转载)
包子题: Implement GetFullPathOfIsolatedFileBUG! Re: xmldocument and webservice
How to use openFileDialog() to save a binary file in .net C++hexadecimal value 0x00, is an invalid ch
相关话题的讨论汇总
话题: string话题: filename话题: boolean
进入DotNet版参与讨论
1 (共1页)
c**t
发帖数: 2744
1
I was pulling my hair out while try to resolve the follow exception
using(StreamWriter sw = new StreamWriter(fileName, false))
{
sw.Write(someString);
sw.Close();
};
it's because the fileName has ':' in it!! great bug!!
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(
String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(
Fi
c**t
发帖数: 2744
2
to remove illegal characters from file name:
private static string MakeValidFileName( string name )
{
string invalidChars = Regex.Escape( new string( Path.
GetInvalidFileNameChars() ) );
string invalidReStr = string.Format( @"[{0}]", invalidChars );
return Regex.Replace( name, invalidReStr, "_" );
}

【在 c**t 的大作中提到】
: I was pulling my hair out while try to resolve the follow exception
: using(StreamWriter sw = new StreamWriter(fileName, false))
: {
: sw.Write(someString);
: sw.Close();
: };
: it's because the fileName has ':' in it!! great bug!!
: at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
: Boolean needFullPath)
: at System.Security.Util.StringExpressionSet.CreateListFromExpressions(

a***x
发帖数: 26368
3
A filename cannot contain any of the following characters:
\ / : * ? " < > |

,

【在 c**t 的大作中提到】
: I was pulling my hair out while try to resolve the follow exception
: using(StreamWriter sw = new StreamWriter(fileName, false))
: {
: sw.Write(someString);
: sw.Close();
: };
: it's because the fileName has ':' in it!! great bug!!
: at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
: Boolean needFullPath)
: at System.Security.Util.StringExpressionSet.CreateListFromExpressions(

c**t
发帖数: 2744
4
figured that out already

【在 a***x 的大作中提到】
: A filename cannot contain any of the following characters:
: \ / : * ? " < > |
:
: ,

k*****G
发帖数: 697
5
Very informative, thanks for sharing.
u***n
发帖数: 33
6
Thanks for sharing.

【在 c**t 的大作中提到】
: I was pulling my hair out while try to resolve the follow exception
: using(StreamWriter sw = new StreamWriter(fileName, false))
: {
: sw.Write(someString);
: sw.Close();
: };
: it's because the fileName has ':' in it!! great bug!!
: at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
: Boolean needFullPath)
: at System.Security.Util.StringExpressionSet.CreateListFromExpressions(

1 (共1页)
进入DotNet版参与讨论
相关主题
hexadecimal value 0x00, is an invalid ch[合集] 问一个Response.WriteFile的问题
HttpWebRequest小程序C#的new在method declaration里有和没有有啥区别么
how they did elgooG包子题: Implement GetFullPathOfIsolatedFile
how to use old DLL in VB .NET?How to use openFileDialog() to save a binary file in .net C++
System.Data.SqlClient.SqlException: A network-related or instance -specific errorWebClient is not thread-safe!
easy question, but ...LinqPad is handy
新手问个问题哈,关于C#的Newbie ASP.NET question
a question about C++.net class librarynHibernate mapping question
相关话题的讨论汇总
话题: string话题: filename话题: boolean