Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Learning ASP.NET ... Where to Store Functions

Posted on 2011-02-22
2
Medium Priority
?
244 Views
Last Modified: 2012-05-11
Hello,

I have developed a number of MS Access applications in the past, and am now learning ASP.NET (version 4) in order to develop web applications.

In MS Access, the VB code is stored in either the form / report which uses it exclusively (private subs / functions), or in a module (public subs / functions).

In ASP.NET, I know that each aspx file has a .vb file with code that belongs to that page. My question is in how to organize the "public" code that can be called from multiple pages ... where should these public subs/functions be stored?

Thanks in advance -
0
Comment
Question by:JMS1965
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1000 total points
ID: 34952217
If you just want a file full of public methods, rather than going the OO approach of actually wrapping them as objects, then you can just add a class file to your project and mark your methods as Public and Shared.

i.e.
Public Class SharedMethods
    Public Shared Function MyMethod() As String
       Return "Hello World"
    End Function
End Class

Open in new window

0
 
LVL 21

Assisted Solution

by:Alpesh Patel
Alpesh Patel earned 1000 total points
ID: 34952546
Create Class and store it in App_Code folder to access to anywhere in application.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question