Reference another file from code-behind page...?

B

Bodyboarder20

Hey,

I'm sure this is an easy question for most.

I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....

Page1.aspx ---> Page1.aspx.cs ---> globallibrary.cs

Is this possible?

Thanks!
 
J

Juan T. Llibre

re:
!> I would like to create a class with a bunch of "library" functions...
!> But I'm not sure how I would configure it so that I can call functions
!> from one "code" file from another "code behind" file....

Place globallibrary.cs in the App_Code directory.
 
G

Guest

Hey,

I'm sure this is an easy question for most.

I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....

Page1.aspx ---> Page1.aspx.cs ---> globallibrary.cs

Is this possible?

Thanks!

globallibrary_class_name.public_static_function_name();

public class globallibrary_class_name
{
public static string public_static_function_name()
{
return "hello";
}
}
 
B

Bodyboarder20

Do I need to put any spacial tags at the top of the page1.aspx.cs file
to point it to the globallibrary.cs file?
 
J

Juan T. Llibre

For ASP.NET 1,1, compile the code from the command-line,
and import/reference the resulting assembly.

Open a command window and make sure the
1.1 .Net Framework directory is in your system path, by running

PATH= %PATH% & C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;

Substitute the correct drive letter if you're booting from a different drive.

Also, if you have a non-standard Windows install,
replace "windows" with your custom-named install directory.

To compile a single source code file, use :

csc /t:library /out:globallibrary.dll globallibrary.cs

To compile all .cs files in a directory to globallibrary.dll ,
use : csc /t:library /out:globallibrary.dll *.cs

If you need to reference a .Net Framework assembly or assemblies,
add them, separated by slashes :

csc /t:library /r:system.dll /r:system.data.dll /out:globallibrary.dll *.cs

Once you have compiled your assembly, place it in the /bin
directory of your application, and import your class Namespace in any aspx page:

<%@ Import Namespace="YourNameSpace" %>

If you're working with VS.NET, compile your assembly
as described and add a reference to it in your VS.NET project.

That will allow you to use Intellisense and get your
assembly's properties, methods, etc. when coding.





Oh, btw... this is .NET 1.1 ( I know, my work is nuts )
 
J

Juan T. Llibre

re:
!> Perfect solution!!!

Except that I fudged the path to the 1.1 Framework directory...

That should have been :

PATH= %PATH%;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;

Sorry...

Other than that, everything stands...and you're quite welcome.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top