?
Solved

Learning ASP.NET ... Where to Store Functions

Posted on 2011-02-22
2
Medium Priority
?
241 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

752 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