This is really strange. If I run this in a wpf application:
SKYPE4COMLib.Skype mySkype = new SKYPE4COMLib.Skype();
I get no errors.
I want to run that in a asp.net application. when I do run it there I get:
note that I don't get any build errors and the error arises at run-time. The SKYPE4COMLib.Skype class is provided by Skype and can be downloaded from here. I don't understand why I am able to instantiate an object from that class just if I am using a wpf appliation.
Things I have tried: (recall I want to use that library from my asp.net application)
1) Adding a wpf application to my solution. Then referencing that project from my asp application. I get the same error.
2) Tried to create a web service and instantiate the class in the web service. That does not work eather.
3) Change the target framework from .Net Framewrok 4 Client Profile to different ones. This solved the problem I was able to instantiate the class but then I am not able to call the methods.
I am having a hard time understanding why I am able to instantiate an object from a class if I am in a wpf application but not in a .net application or even a console application! I seems as if skype is trying to block that on purpose.
After long hours of trying I decided I where going to make my wpf application a console application by adding the necessary references and classes. Then I compared and I noticed that if I added:
to the main method it works!!!!!
as a result my main method now should look like:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
on asp.net there is not a main method. well not one that I know of. so in asp.net I had to add the AspCompat attribute equal to true.
so my asp.net aspx pages now look like: