473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Code Reusability -- Extending web Application

Hi,

This is a code reusability question. I want to include a function that sends an email message from my site. I want to include the code for the function only once and then be able to call this function from any of my pages.

I am aware that there are a number of different solutions to this problem -- user controls and "separate" assemblies are some of them.

What I really want is to extend the Application class (HTTPApplication or HTTPContext -- I am confused as to what does what) to achieve this functionality. In my uneducated terms, I want to open a class definition somewhere in my web project, add a couple of functions, and then be able to access these functions from other pages.

Global.asax and HTTPModules seem to provide this type of functionality for events but how can I do functions at the web application level?

Thanks for your advice.

Zheny
http://www.rusmex.com
Nov 18 '05 #1
3 1531
It sounds like you're confused. Your best bet would be to implement a class
library for this sort of reusable functionality.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"po*****@rusmex.com" <an*******@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
Hi,

This is a code reusability question. I want to include a function that sends an email message from my site. I want to include the code for the
function only once and then be able to call this function from any of my
pages.
I am aware that there are a number of different solutions to this problem -- user controls and "separate" assemblies are some of them.
What I really want is to extend the Application class (HTTPApplication or HTTPContext -- I am confused as to what does what) to achieve this
functionality. In my uneducated terms, I want to open a class definition
somewhere in my web project, add a couple of functions, and then be able to
access these functions from other pages.
Global.asax and HTTPModules seem to provide this type of functionality for events but how can I do functions at the web application level?
Thanks for your advice.

Zhenya
http://www.rusmex.com

Nov 18 '05 #2
Kevin,

I am new to ASP, so yes, I am confused... There seems to be so many ways in .NET to do the same tasks...

So, you suggest that I compile a separate class assembly and include it in my solution. Then, add references to this accembly from my web project. Did I understand you correctly?
Nov 18 '05 #3
> So, you suggest that I compile a separate class assembly and include it in
my solution. Then, add references to this accembly from my web project. Did
I understand you correctly?

Exactly. A Class Library is a DLL containing classes that can be used by any
other .Net application. In fact, the entire CLR (Common Language Run-time)
is a set of Class Libraries.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"po*****@hotmail.com" <an*******@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.com...
Kevin,

I am new to ASP, so yes, I am confused... There seems to be so many ways in .NET to do the same tasks...
So, you suggest that I compile a separate class assembly and include it in my solution. Then, add references to this accembly from my web project. Did
I understand you correctly?

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
3
by: Erik De Keyser | last post by:
Hi group, I have a couple of projects with up to 8 forms. On most projects I write the code on each form with no modules. The last project I use 1 module and minimal code on each form , in fact...
1
by: Richard Townsend | last post by:
In the "Extending and Embedding" part of the Python documentation: section 5.4 "Extending Embedded Python" - it describes how to use a Python extension module from Python that is embedded in a C...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
4
by: Simon | last post by:
Hi all, I'm hoping that some of you clever chaps could offer me some advice on code reuse. You see, whenever I make applications, I typically only find very limited
8
by: neilmcguigan | last post by:
I just wanted to list some reasons why I prefer inline code to code-behind. 1. you can fix some bugs more quickly. remote desktop into server, change the aspx file, and she's good to go. I'd say...
5
by: vbgunz | last post by:
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where...
47
by: mister catering | last post by:
I have a doubt... why is so dificult to reuse software developed under the same language (not only c of course) and under the same compiler?. It seems the language itself is not enough to build a...
0
by: Jerry Mcnealy | last post by:
There is an interesting article on java.net about SOA reusability, Shrinking the Lag between Business and IT: http://today.java.net/pub/a/today/2007/07/24/soa-reusability-shrinking-lag-time.html...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.