|
-
May 18th, 2006, 10:05 AM
#1
asp include files to asp.net
I'm trying to migrate an existing 3-tier application to asp.net 2.0 (with VB.net), and would like to know the best way to handle the existing include files. These include files mostly consist of just a handful of sub routines or functions per each include file. Do I just convert each of these into their own little class and put them in app_code (and put an imports statement on the page that wants to use that class's functions/subs)? ...or do I convert them to just plain Modules (declaring as Public Module instead of Public Class)? What is the most efficient way to do this?
Thanks
...also, why doesn't VS 2005 allow you to select a Module when adding an item to your project, like VS 2003 did?
Last edited by jaklotz; May 18th, 2006 at 10:33 AM.
-
May 18th, 2006, 11:13 AM
#2
Re: asp include files to asp.net
Put the includes into classes.. (inside a namespace)
i.e
Code:
NameSpace YourNamespace
Public Class CommonFunctions
Public Function SomeFunction() as Boolean
End Function
End Class
End Namespace
' In your aspx.vb page
Include YourNameSpace.CommonFunctions
somevariable = SomeFunction()
hope this helps
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010
-
May 18th, 2006, 12:35 PM
#3
Re: asp include files to asp.net
That does help - so is this more efficient than just using a user control, and that's why you suggested it?
And if I want to assign stuff to a Session variable, then I could just use:
HttpContext.Current.Session("VarName") = somevalue
Correct (it seems to work)?
Also, do I put this in App_Code? ..or does it not matter what folder in my website project it goes into? ...also, why does it have to be in a namespace?
Thanks!!
-
May 18th, 2006, 06:31 PM
#4
Re: asp include files to asp.net
Hi again
so is this more efficient than just using a user control?
Ya lost me there What kind of user control are you thinking of?
And if I want to assign stuff to a Session variable...
Yup correctamundo 
do I put this in App_Code?
I don't think so (although thats were I normally put it).
why does it have to be in a namespace?
Some wiseguy at microsoft thinks its a good way to organise your classes. You can have seperate files with different classes within the same namespace. In asp, you only have a few built in classes (response, server, request etc...). In asp.net you have gazillions within their namespaces.
Good luck with it
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|