common libraray

  • Thread starter Thread starter SAI
  • Start date Start date
S

SAI

In old asp, we like to write some "inc" file for including some common
shared functions between pages. How to do it in asp.net? should I use .cs
file to do it? Besides, should I compile these .cs file? any links for
reference? thanks so much.
 
In old asp, we like to write some "inc" file for including some common
shared functions between pages. How to do it in asp.net? should I use .cs
file to do it? Besides, should I compile these .cs file? any links for
reference? thanks so much.
You can still use include files, but with some difficulty as to mixing
lanaguages. A better way is user controls (ascx files)
 
Just create a set of classes and methods in some library project, then just
reference these classes in each page.

If you want to share common visual elements, then you can use usercontrols
or custom webcontrols.
 
No. I only share non-visual functions. Should I use ".cs" file and compil
it? (I use C#) Thanks.
 
Depends on whether you want to use the code on the client or on the server.
For client script you may include a script file like this in your .aspx page
<script src="/includes/myscript.js" defer type="text/javascript"></script>.
For the server side, you would like to include the functionality in a .cs
class. Such class may be included within the project or it may be compiled as
a dll in an external project and then referenced in your current project.
 

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

Back
Top