ASP.net最大特点就是不用注册DLL也可调用,调用方法如:
dim dll
dll=Server.CreateObject("dllname.myclass")
dll.yousub()应该是这样吧,如有错请指出,因为我也是刚学asp.net

解决方案 »

  1.   

    我原来是.cs文件有一个myClass类;
    在.aspx中引用:
    <%@ Page Src="myClass.cs" Inherits="myClass" %>
    能够通过但将.cs文件编译为DLL文件后
    想用<%@ Import namespace="myClass" %>(beta1版的教程好象都这样引用)
    进行引用,但出错,说不能识别myClass;
    我想知道Beta2版或正式版调用的方法,非常感谢!
      

  2.   


    <% @ Register TagPrefix="dllname" Namespace="dllname" Assembly="dllname" %>
      

  3.   

    详细如下:
    编译的文件名,必须与控件中namespace的名字一致。例如using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;namespace SampleControls 
    { public class Composition2 : Control, INamingContainer 
    {
    }
    }csc /t:library /out:SampleControls.dll /r:System.Web.dll Composition2.cs
    编译后直接考到bin目录。或者
    csc /t:library /out:./bin/SampleControls.dll /r:System.Web.dll Composition2.cs然后在*.aspx里这样使用
    <%@ Page Language="C#" %>
    <%@ Register TagPrefix="SampleControls" Namespace="SampleControls" Assembly="SampleControls" %>
    <html>
    <body>
    <form method="POST" action="Composition2.aspx" runat="server" ID="Form1">
    <SampleControls:Composition2 id="MyControl" runat="server" />
    </form>
    </body>
    </html>