locked
Problem on writing a chinese character by ASP.Net RRS feed

  • 問題

  • Hi all,

     

    I am having a problem on writing a chinese character to a text file by asp.net.  It works fine on writing non-chinese character.  Could you give me some suggestions whether I need to change some of my code or server's settings to get it work?

     

    Sample code:

        Dim objFSO = CreateObject("scripting.filesystemobject")
        Dim objOutput = objFSO.CreateTextFile("FIlename", True)
        objOutput.WriteLine("中文") <- it fails with following error:

     

     

    Server Error in '/' Application.

    Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL)

     

    Many thanks.
    2008年4月11日 上午 07:12

解答

  • Hi chiuching,

     

    If you're using ASP.NET, you are recommended to use System.IO namespace for text file reading/writing.

    For example,

    Code Snippet

     

    System.IO.StreamWriter StreamWriter1 = new System.IO.StreamWriter("Sample1.txt");
    StreamWriter1.WriteLine("PutYourContentHere");
    StreamWriter1.Close();

     

     

     

    Regards,

    Colt

    2008年4月21日 上午 02:24

所有回覆

  • Problem solved, please ignore. Thx!

     

     

    2008年4月11日 上午 09:22
  • Hi chiuching,

     

    If you're using ASP.NET, you are recommended to use System.IO namespace for text file reading/writing.

    For example,

    Code Snippet

     

    System.IO.StreamWriter StreamWriter1 = new System.IO.StreamWriter("Sample1.txt");
    StreamWriter1.WriteLine("PutYourContentHere");
    StreamWriter1.Close();

     

     

     

    Regards,

    Colt

    2008年4月21日 上午 02:24
  •  ColtK 寫信:

    Hi chiuching,

     

    If you're using ASP.NET, you are recommended to use System.IO namespace for text file reading/writing.

    For example,

    Code Snippet

     

    System.IO.StreamWriter StreamWriter1 = new System.IO.StreamWriter("Sample1.txt");
    StreamWriter1.WriteLine("PutYourContentHere");
    StreamWriter1.Close();

     

     

     

    Regards,

    Colt

     

    That's the exactly solution I have found.

    Thx anyway.

     

    Regards.

     

    2008年4月21日 上午 03:02
  • Hi chiuching,

     

    If you find this post is useful, can you please kindly click "這篇文章有用嗎?".

    This would keep the community useful and grow. Smile


    Thanks,

    Colt

    2008年4月21日 上午 10:12