VB6 Components in ASP.NET

kunal160

New Member
I am trying to consume my old vb6 components in my asp.net project by simply adding them to the in directory. This is not working as of right now. Am I going to have to write vb.net wrappers for all of my old components to work in .NET? Will *that* even work, or does the whole component have to be compiled in .NET to run on the platform? If I can provide more detail or clarity in this question, please let me know. Thanks in advance.You can use your old COM components. Just register them via regsvr32 like you would do for ASP, then create instances of them like so:<BR><BR>Dim obj<BR>obj = Server.CreateObject("ProgID")<BR><BR>Note that you will also need to add:<BR><BR><%@ Page ASPCompat="True" %><BR><BR>to the top of your ASP.NET Web page. This tells ASP.NET that you're using old COM components that may use single threaded apartments (STAs), meaning that ASP.NET switches from a multi-threaded apartment model to an STA model for that page. This can have a perf degradation, hence the benefit of creating a VB.NET wrapper. There are also free tools in the .NET SDK for creating .NET wrappers for existing COM components.<BR><BR>Happy Programming!
 
Back
Top