Reusable functions

D

Danny

In classic ASP, if I have a function that will be used many times, I just
put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that function.

How do I do this in ASP.Net? Got bit confused, especially because HTML and
the VB.Net code is located in separate files.

Thanks in advance,

- Danny
 
G

gabriel

Danny said:
In classic ASP, if I have a function that will be used many times, I
just put it in include file, and add, for example <!-- #include
file='myfunction.inc' --> in the file where I want to use that
function.

You gotta change your mindset. Look into "class libraries." They work
different, but are infinitely better than #included files.
 
K

Kevin Spencer

ASP is procedural, whereas ASP.Net is object-oriented. In ASP, you could
create re-usable functions. In ASP.Net, you create re-usable classes, which
are much better, because they can contain functions (Methods) as well as
data (Properties and Fields). Instead of including them with server-side
includes, you reference them (the assemblies/DLLs containing them) from your
other classes.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top