Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with downloading arabic named file..

Problem with downloading arabic named file..

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    khurram rathor
    wrote on last edited by
    #1

    Hello Everyone, I'm working on some application. One of the form is getting file bytes by calling WebService Method. My Code is Downloading the file perfectly, but the problem is with arabic named file, that its name shows Garbage Characters in SaveFile Dialogue Box before downloading. I'm doing like this.. Dim obj As tecra.BrowserInfo = CType(Session("objService"), tecra.BrowserInfo) Dim chk As Boolean Dim cookieJar As System.Net.CookieContainer If (Session("cookieJar") Is Nothing) Then cookieJar = New System.Net.CookieContainer Session("cookieJar") = cookieJar End If obj.CookieContainer = Session("cookieJar") chk = obj.DownloadDoc(Session("ID"), CType(Doc_Id, Long), bt, FileName, FileType) If chk = True Then Dim strPath As String = "C:\" & FileName.Trim() & "." & FileType.Trim() Dim Image_Bytes() As Byte = bt Dim File_Image = New System.IO.FileStream(strPath, IO.FileMode.Create, IO.FileAccess.ReadWrite) File_Image.Write(Image_Bytes, 0, Image_Bytes.Length) File_Image.Close() Dim ms As New System.IO.MemoryStream(bt) Response.Clear() Response.ContentType = "APPLICATION/OCTET-STREAM" Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName.Trim() & "." & FileType.Trim() & "; size = " & bt.Length.ToString()) Response.CharSet = "1256" Response.AddHeader("Content-Length", bt.Length) Response.Flush() Dim chunkSize As Integer = 10994042 Dim i As Integer For i = 0 To bt.Length Step chunkSize If (Not Response.IsClientConnected) Then Exit For End If Dim size As Integer = chunkSize If (i + chunkSize >= bt.Length) Then size = (bt.Length - i) End If Dim chunk(size - 1) As Byte ms.Read(chunk, 0, size) Response.BinaryWrite(chunk) Response.Flush() Next ms.Close() bt.Clear(bt, 0, bt.Length) Response.Close() End If Can anyone tell me that what is the problem with arabic named files, though English named files are fine. My window also support Arabic. Thanks. khurram rathor

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups