Web User Control to DLL and use it

pitaridis

Well-known member
Joined
Nov 18, 2005
Messages
63
Programming Experience
10+
I have a problem and I am looking for a solution because I have been looking for 3 days now but google did not help me. For almost all my ASP.NET pages I create controls in order to make my sites as object oriented as possible. The problem is that I do not want other people to be able to see my code. So I thought that converting them to DLL will help me.

By googling I found that using a command like the following I can compile a control that has been written in 100% vb code.

VB.NET:
vbc /t:library /out:ShowList.dll /r:System.dll /r:System.Web.dll ShowList.vb

My problem is that all the controls that I create have the following structure.

I have an ASPX file like the following:
VB.NET:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="TimeControl.ascx.vb" Inherits="TimeControl" %>
<asp:Label ID="lblTime" runat="server"></asp:Label>

I have the equivalent VB file:
VB.NET:
Partial Class TimeControl
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lblTime.Text = Now
    End Sub
End Class

Now I have 2 questions.

1. How can I compile this control to dll?
2. How can I use it in an ASPX page?

Thank you in advance.
 
Back
Top