Free Support Forum -

How to translate HTML page into other languages in .NET using Aspose.HTML REST API

I got an exception (“Error calling GetTranslateDocument: StatusCode=500 (InternalServerError); One or more errors occurred.”), when I ran following fragment:

string BasePath = "";

string name = "test.html";

string outPath = @"c:\tmp\";
string outFile = Path.Combine(outPath, $"{Path.GetFileNameWithoutExtension(name)}");

const string srcLang = "en"; // String | Source language.
const string resLang = "ru"; // String | Result language.
string folder = null;     // root folder
string storage = null;    // default storage

    ITranslationApi transApi = new TranslationApi(AppKey, AppSid, BasePath);
    var response = transApi.GetTranslateDocument(name, srcLang, resLang, storage, folder);

    if (response is FileStream)
        if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath);
        using (Stream fstr = new FileStream(outFile, FileMode.Create, FileAccess.Write))
            Console.Out.WriteLine($"Result file copied to: {outFile}");
catch (Exception ex)
    Console.Out.WriteLine($"Error: {ex.Message}");


Thank you for contacting us.

It looks like an outdated code. Please check Translate HTML page article for updated cURL and SDK Examples.

Cloud SDKs for all major platforms are available at

We hope this helps!