0

We have a 3rd Party Piece of software that I'm wanting to apply some automation to through a COM Object that they make available. I've been using a Windows Forms App so far, but would really like to start working on an intranet site for the company which is something that they are lacking at the moment.

So is this something that is possible? Are you able to access a COM Object through an ASP.NET Application (MVC3 or 4) in an intranet situation?

I've looked at simply having the server control the application through the software that is installed ON the server, but the application uses our Active Directory to control access and they don't provide a good way to pass the credentials around so unless I'm missing something I would need to have a user that has all the access that anyone would need and then enforce the restrictions through code which is enough of a reason that I will continue with a Windows Forms App instead of an intranet app.

EDIT: Accessing the COM Object from javascript is also an option if this is possible somehow.

Jared
  • 5,840
  • 5
  • 49
  • 83
  • Do you know if the object uses an MTA or STA threading model? – Joachim Isaksson Oct 07 '12 at 05:26
  • I have no clue. I've actually never even heard of that before. – Jared Oct 08 '12 at 18:06
  • After looking on MSDN it makes since that it would be single vs multi threaded. I would ASSUME that it's multi, but I'm not sure how to find out for sure. Is there a way to find this out when you don't have access to the source? – Jared Oct 08 '12 at 18:14
  • I'll try to look into it when I have the time, I'm actually not sure how to check easily :) – Joachim Isaksson Oct 08 '12 at 18:34
  • @JoachimIsaksson Also, while this was good info does this play into the ability to access the object? – Jared Oct 08 '12 at 19:34
  • STA may cause some problems unless you set `aspcompat=true` in your page directive. There is some info [at this link](http://stackoverflow.com/questions/1390203/how-do-i-use-a-com-component-from-vb-net) about how to use COM directly from ASP.NET, with some info on what STA could mean. – Joachim Isaksson Oct 08 '12 at 19:44

1 Answers1

1

I use the following javascript code to start an instance of Excel on the client machine. It will only work with Internet Explorer. Perhaps you could do the same with your object.

var excelApp, excelFile;
  function initExcel(filename)
  {
    excelApp = new ActiveXObject("Excel.Application");
    excelFile = excelApp.Workbooks.Open(filename);
  }
enhzflep
  • 12,927
  • 2
  • 32
  • 51
  • +1 for A solution, but I don't want it to be dependent on a specific browser. (especially not if that browser is IE :) ) – Jared Oct 08 '12 at 18:05
  • Cheers, this looks like a better solution perhaps? http://asp.net-informations.com/excel/asp-excel.htm (or perhaps not - I'd forgotten you want to do it on the client machine) Perhaps you could look into RPCs - there seems to be a lot of info avail - Ah! It's known as ".NET Remoting" - http://en.wikipedia.org/wiki/.NET_Remoting – enhzflep Oct 08 '12 at 20:23
  • For future visitors... This wasn't the solution I chose as I needed a more browser neutral solution if it was going to be done in the browser, but this is A solution. – Jared Oct 13 '12 at 20:14