Question Accessing DLL Object via javascript

tamjap

New member
Joined
Jul 3, 2012
Messages
1
Programming Experience
5-10
I hope this is the correct location for this question.

I have a c# project with a browser front end. One small piece of the project is a .DLL written in C# that handles various printing functions. Currently, the one I am interested in returns a list of available printers to populate a custom printer interface. When the page loads, a scripting object is added to the page to reference the object created from the class:
C#:
clientside.scripting.InsertClientScript("printutilityobject", "<object id='printUtility' classid='MyPrinting.dll#MyPrinting.PrinterUtilities' width='1' height='1'></object>", false, this.Page);

An external javascript routine is called when the print button is pressed that grabs the printUtility object and iterates through the printer list contained in the object:
C#:
function _objPrint()
{
    objPrint = document.getElementById("printUtility");
}
function LoadPrinters()
{
    if (objPrint == null)
    {
        _objPrint();
    }
    var count = objPrint.PrinterCount();
    .
    .
    .

This setup appears to work fine on some machines, but not on others (including mine). I get an error "Object doesn't support this property or method" when I hit the "objPrint.PrinterCount()" line. When I view the object in the watch window, it looks like a generic object. It doesn't contain any of the properties or methods that are in the class. Because this works in some environments and not others, I am inclined to believe it should be a setting change somewhere between IE, IIS, or .NET/ASP, but I can't find anything and am kind of out of ideas. Any help would be appreciated.

Thanks,
Tamjap
 
Top Bottom