Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
French characters with IO.FileInfo
Message
 
 
To
14/04/2011 13:02:29
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01507321
Message ID:
01507360
Views:
44
Check if this discussion may be of help
http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames

>If even try to Decode the file name and plug the mime type, such as:
>
>
>            ' Get the file length
>            oProcess.oResponse.Clear()
>            oProcess.oResponse.ClearContent()
>            oProcess.oResponse.ClearHeaders()
>            oProcess.oResponse.Charset = cCharset
>            'oProcess.oResponse.ContentType = cContentType
>            oProcess.oResponse.ContentType = GetMimeType(lcFileName)
>            oProcess.oResponse.AddHeader("Content-Disposition", "attachment;filename=""" + oApp.Decode(lcFileName) + """")
>            oProcess.oResponse.AddHeader("Content-Length", lnSize.ToString())
>            oProcess.oResponse.ContentEncoding = System.Text.Encoding.GetEncoding(cContentEncoding)
>
>            oProcess.oResponse.TransmitFile(cFile)
>
>            ' Make sure to end this process as we do not want any additional process to occur
>            oProcess.oResponse.End()
>
>            Return True
>        End Function
>
>        Private Function GetMimeType(fileName As String) As String
>            Dim mimeType As String = "application/unknown"
>            Dim ext As String = System.IO.Path.GetExtension(fileName).ToLower()
>            Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext)
>            If regKey IsNot Nothing AndAlso regKey.GetValue("Content Type") IsNot Nothing Then
>                mimeType = regKey.GetValue("Content Type").ToString()
>            End If
>            Return mimeType
>        End Function
>
>
>But, that generates the "Illegal characters in path." at the TransmitFile() line and the browser runs indefinitely waiting for something.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform