Reputation: 61775
I've got an ASP.net file, and I'm trying to include dynamic code which was easy in classic ASP.
Here is what I have tried so far:
<%@ Register TagPrefix="TagPre" TagName="header" Src="alg/classes.aspx"%>
and
<!--#include file="alg/classes.aspx"-->
But neither of these seem to work. The content of classes.aspx is:
<script runat="server">
' Square class
Public Class square
Public sqRows As Integer 'Numbers of rows this square has
Public sqCols As Integer 'Number of columns this square has
Public sqArray(,) As Integer 'The square array
' Initialise square array to match size of canvas
Public Sub initSqArray(ByVal canvCols, ByVal canvRows)
ReDim sqArray(canvCols, canvRows)
sqRows = canvRows
sqCols = canvCols
End Sub
End Class
Thanks for any help!
Upvotes: 0
Views: 2372
Reputation: 6867
You should not need to use include or register to access a class. You just need to save your class to a class file (.vb) and put the class in your app_code directory (if you are using a website project) or put it anywhere in a web application project (preferrably a folder for classes) but include it in your project namespace. This should make your class visible anywhere in the website or web application.
Upvotes: 1
Reputation: 87
What is the concrete problem or error you got? When you are using .aspx, did you already try to put the VB-Code in the Code-Behind-Sheet and pull it from there?
Upvotes: 1