How do I do this?

  • Thread starter Thread starter Kjell Kristiansson
  • Start date Start date
K

Kjell Kristiansson

I am writing an applictaion consisting of several web pages and web forms.
In one file, A.vbs, I have defined several of my classes within Namespace
A.
Now I want to create another Namespace A.Util in another file.
Here I want to put utility functions that I need in a several places
within
some classe but also outside within the Page_load event.

Questions:
1) Is it possible to create just the utility functions in the file without
putting them within a class that I have to instansiate?
2) Within one of the functions I want to access Session-variables set by
an
ASP page.
Which is the simplest way to to access this information? What imports
do
I need?
3) I want, in one of the functions, do a transfer to another page like
using
server.transfer(xxx).
What is best practice? What imports do I need.

I have evertything working but I want a better structure of the source
code
and better reuse.
When I moved out code from the page I got problems with the session
variables and the server.transfer.
I have scanned my litterature and and the web but found few examples
covering code separated into several files.

Thanks

Kjell K.
 
Kjell Kristiansson said:
I am writing an applictaion consisting of several web pages and web forms.
In one file, A.vbs, I have defined several of my classes within Namespace
A.
Now I want to create another Namespace A.Util in another file.
Here I want to put utility functions that I need in a several places
within
some classe but also outside within the Page_load event.

Questions:
1) Is it possible to create just the utility functions in the file without
putting them within a class that I have to instansiate?

You can do this by creating a class with Shared Methods, Shared Properties
and Shared Functions. To access the Shared items you would not need to
instantiate the class.

You might get more specific answers to your other questions in one of the
ASP.NET specific groups.
 

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