Using .NET Assembly (DLL) in ASP page


1. Create a Assembly file using following:
        File >> New >> Project >> Class Library >> Name = MyLibCSharp
 
2. Add a function HelloWorld. Code will look as follows:

using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.InteropServices;

namespace MyLibCsharp

{

[Guid(“FE1EB79E-3513-487e-ADFF-2B61C6CB4730”)]

[ComVisible(true)]

public class Class1

{

public String HelloWorld(String name)

{

return (“Hellow World; Welcome “ + name);

}

}

}

3. Sign the Assembly (To enable it to be used by multiple Applications):

Go to Project >> MyLibCSharp Properties >> Signing >> Sign the Assembly >> New >> Key.snk

4. Enable for COM Interop:

Go to Project >> MyLibCSharp Properties >> Build >> Output >> Check the “Register for COM interop.

5. Build the Assembly.

6. Add to GAC using “Visual Studio Command Prompt” the assembly is located in DEBUG/RELEASE folder.

gacutil -I MyLibCSharp.dll

7. Execute the following:

Regasm /tlb /codebase MyLibCSharp.dll

8. ASP code:

<%

Dim foo

set foo = Server.CreateObject(“MyLibCSharp.Class1”)

Response.Write (foo.HelloWorld(“test”))

%>

9. To unregister the assembly

Regasm /unregister MyLibCSharp.dll

10. And to remove the same from GAC (Global assembly cache)

Go to

C:\WINDOWS\assembly

find the assembly you want to remove

select it , right click it and select uninstall

Bye

 


Discover more from Nishant Rana's Weblog

Subscribe to get the latest posts sent to your email.

Unknown's avatar

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

11 thoughts on “Using .NET Assembly (DLL) in ASP page”

  1. Can you help me please?

    I am getting the following error:
    erver object, ASP 0177 (0x800401F3)
    Invalid class string
    /com/index.asp, line 10

    Marcos de Sousa

    Like

    1. This doesn’t appear to work in Vista Business. I get a :

      Microsoft VBScript runtime error ‘800a01ad’

      ActiveX component can’t create object

      depends.exe suggests that this is because gpsvc.dll can’t be loaded, but there appears to be no more information on this anywhere. Any help greatly appreciated.

      Like

  2. This doesn’t appear to work in Vista Business. I get a :

    Microsoft VBScript runtime error ‘800a01ad’

    ActiveX component can’t create object

    depends.exe suggests that this is because gpsvc.dll can’t be loaded, but there appears to be no more information on this anywhere. Any help greatly appreciated.

    Like

  3. 25 САМЫХ ИНТЕРЕСНЫХ НАРЯДОВ БАЛА AMFAR

    http://youtu.be/FFVJZfL5AaA

    Сегодня в Каннах состоялась одна из самых грандиозных вечеринок фестиваля – бал amfAR «Кино против СПИДа» (Cinema Against AIDS). Незадолго до этого вечера организатор бала Карин Ройтфельд объявила, что мероприятие посвящено Мэрилин Монро, а главный цвет нарядов должен быть выполнен в красной гамме.

    В прошлом и позапрошлом годах звезды довольно четко соблюдали дресс-код, примерив черные и золотые наряды, зато в этом году решили не прислушиваться к словам Карин и представили платья различных оттенков.

    Одним из самых излюбленных цветов звезд стал перламутрово-розовый. Прекрасная Джейн Фонда (Jane Fonda) выбрала открытое корсетное платье на бретельках Atelier Versace, украшенное кристаллами Swarovski. В ее руках был клатч того же бренда, образ она дополнила открытыми туфлями Jimmy Choo и украшениями Chopard. Изабель Гулар (Izabel Goulart), в отличие от прошлого года, выбрала более закрытый наряд: платье-бюстье Emilio Pucci с фактурной объемной юбкой. Нежно-розовую гамму поддержала Айшвария Рай (Aishwarya Rai) в наряде Armani Prive. Она вместе со спутником прибыла на бал одной из первых. Кайли Миноуг (Kylie Minogue) также выбрала перламутровое платье Juan Carlos Obando с верхом из сатина. Модель Ирина Шейк продолжает демонстрировать свои наряды Atelier Versace: на этот раз она открыла правое бедро и левое плечо, а шею спрятала под воротником.

    Like

Leave a reply to awaispogs Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Nishant Rana's Weblog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Power Platform Puzzles

D365 CRM, Power Platform Tips &Tricks

Power Spark

Power Spark By Shrangarika

Van Carl Nguyen

Exploration of Power Platform

My Trial

It is my experience timeline.

Power⚡Thomas

Sharing my knowledge and experience about the Microsoft Power Platform.

Arpit Power Guide

a guide to powering up community

Welcome to the Blog of Paul Andrew

Sponsored by Cloud Formations Ltd

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Microsoft Business Applications Ninja!

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog - PPUG.ORG

AI - Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue

The Professional Paraphraser

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

Power Platform Learning

Your Go-To Resource for Power Apps, Power Automate & More

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.