views:

27

answers:

0

I have a classic asp page which allows a user to upload a file. I can retrieve the binary content of the file (verified this matches the original file exactly) but then I need to pass the data to a COM Visible .Net assembly. The data is marshaled across as a string object but when I decode it using the Unicode encoding there is some data corruption.

Here is the code for the c# method I am calling from the script (just writing it to a file to see what I get back from the script):

    public void AddDocument(string fileContent)
    {
        File.WriteAllBytes(@"c:\debug.tif", Encoding.Unicode.GetBytes(fileContent));
    }

Has anyone dealt with a similar situation? any advice is appreciated =)