Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got it working, finally... :)</p> <p>Use of <code>System.Web.HttpUtility.UrlPathEncode</code> solves the garbage problem but when you open the file, it shows unicode-uncoded names in the filename instead of actual japanese characters.(Well, this is the issue in IE7 and IE6, UrlPathEncode works fine with IE8.)</p> <p>So, instead of using <code>System.Web.HttpUtility.UrlPathEncode</code> you should decode the filname using the encoding used for the Response header.</p> <p>In .NET, by default the encoding of the Response header is utf-8, change it to iso-8859-1. Modify the web.config for the same, as shown below,</p> <pre><code>&lt;globalization responseHeaderEncoding="iso-8859-1" .../&gt; </code></pre> <p>And code would be,</p> <pre><code> //apply Response header's encoding i.e. iso-8859-1 to the filename. Dim fileName as String = "在庫あり全商品を24時間以内に出荷.doc" Dim enc As Encoding = Encoding.GetEncoding("shift_jis") Dim dec As Encoding = Encoding.GetEncoding("iso-8859-1") fileName = dec.GetString(enc.GetBytes(fileName)) //Show Download Dialog box and Writting it on Client Side. Response.ClearHeaders() Response.ContentType = corspBean.ContentType Response.AppendHeader("content-disposition", "attachment; filename=""" + fileName + """") Response.BinaryWrite(bytes) Response.End() </code></pre> <p>Now, one more important thing, I have wasted lot of time because of it, is <strong>this doesn't work on ASP.NET Development Server</strong> i.e the server you use to test/debug the web apps on your local machine. So, deploy the solution on the IIS and test from there. It works perfectly fine on IIS. (and IIS is the destiny of every ASP.NET app ;) so it doesn't matter if it works on ASP.NET Development Server or not)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload