You should look at using a regular expression validator to allow only the
submission of alpha chars? That way you wont have to worry about the
encoding. Also, if you cant do that then use replace to change any invalid
chars to underscores so you would have a valid filename.
--
Regards
John Timney
Microsoft Regional Director
Microsoft MVP
"Anne" <an*@cretei.com> wrote in message news:41**************@cretei.com...
To ensure a filename (entered by a user) does not contain any special
characters, I use the "UrlEncode" method:
string FileName = System.Web.HttpUtility.UrlEncode(textBox.Text);
Unfortunately, the character "*" is not encoded so I have an error
writing on disk if the filename contains a "*".
Is there another C# method that handles all special characters,
including the "*" ?
Anne