/*
Tofu is made of excellent products
Http://www.asp888.net bean curd technology station
If you post this article, please retain the copyright information
*/
In asp +, we have a way to use pre-compiled code instead of compiled binary (build-in) components.
Let's take a look at an example.
You may use code similar to the following:
<% @ Assembly src = "test. cs" %> // Compile C # class
<% @ Assembly src = "test. vb" %> // Compile VB class
At the top of the code, we use this code to tell the compiler to compile the Class contained in the file into the asp + Page.
Test. cs:
Public class MyClass {
Public string SaySomething (){
Return "bean curd is made of excellent products ";
}
}
Test. vb:
Public class test
Readonly Property SaySomething () as string
Get
SaySomething = "bean curd is made in excellent products"
End get
End Property
End class
Test. aspx:
<% @ Assembly Src = "test. vb" %>
<Html>
<Script language = "VB" runat = server>
Sub Page_Load (Sender as Object, E as EventArgs)
Dim Temp as New test
LblMsg. Text = temp. SaySomething ()
End Sub
</Script>
<Body>
<Asp: label id = "lblMsg" runat = server/>
</Body>
</Html>
Author: tofu ()