Solved

Learning ASP.NET ... Where to Store Functions

Posted on 2011-02-22
2
240 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 250 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 250 total points
ID: 34952546
Create Class and store it in App_Code folder to access to anywhere in application.
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

707 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