how to access a user-written dll's functions in aspx single page (not -codebehind)

I want to write an aspx page (single page preferred over code behind) that has a script block that calls functions I put in a dll. Can somebody give me a Hello world example. To make it simple, assume the function in the dll has one string parameter and returns a string value. Put the return value in a textbox at page load or something simple. I'm interested in the syntax to connect to the dll. If important, I have VS 2005.

Thank you.
MikeBroderickAsked:
Who is Participating?
 
Sachintana DissanayakeConnect With a Mentor Senior Web DeveloperCommented:
Create a class library called HelloLibrary (Code Snippet1).
Create a separate web project with the aspx page without codebehind file (Code Snippet2).
Add a project reference to HelloLibrary from the web project.
Just run the project.

Hope you get what you expected.
Code Snippet1:
 
Namespace HelloLibrary
    Public Class HelloClass
 
        Public Shared Function CallHello() As String
            Return "Hello Hello"
        End Function
 
    End Class
End Namespace
 
 
Code Snippet2:
 
<%@ Page Language="VB" AutoEventWireup="false" %>
<%@ Import Namespace="HelloLibrary" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <%=HelloLibrary.HelloLibrary.HelloClass.CallHello()%>
    </div>
    </form>
</body>
</html>

Open in new window

0
 
MikeBroderickAuthor Commented:
OK. Thanks.
I tried it and it worked. I apologize but I wasnt explicit. I did not want to build snippet 2 into a web application. I would like to enter it directly (using notepad or dreamweaver for example). The thing that gets me stuck is how to perform the equivilant to "add a reference" to point to the dll from notepad. Is this possible?
0
 
Sachintana DissanayakeConnect With a Mentor Senior Web DeveloperCommented:
Add the HelloLibrary.dll to /bin folder in the web application.
Create a folder called bin inside the web application root.
That's it, no need to compile the web solution.
0
 
MikeBroderickAuthor Commented:
That worked like a champ! Thank you.
0
 
Sachintana DissanayakeSenior Web DeveloperCommented:
Cheers:)
0
All Courses

From novice to tech pro — start learning today.