By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Code Reusability -- Extending web Application

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
> 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 discussion thread is closed

Replies have been disabled for this discussion.