473,805 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 (HTTPApplicatio n 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 1549
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*******@disc ussions.microso ft.com> wrote in message
news:F7******** *************** ***********@mic rosoft.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 (HTTPApplicatio n 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*****@hotmai l.com" <an*******@disc ussions.microso ft.com> wrote in message
news:B7******** *************** ***********@mic rosoft.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
3870
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 users, and listing assignments use similar type commands. Is there a "better" way I can organize my code?
3
3809
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 just the code for each visual object, and all the subroutines are placed in a module. What is the best practice where I can place my VB code, at each form or in a separate module ? Pro's & con's ? Performance benefit ?
1
1732
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 application. Is it safe to call Py_InitModule() more than once in the same application - in order to be able to use more than one extension module? -- Richard
17
2727
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 know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
4
1562
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
1756
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 this is one of the major reasons classic ASP became so popular. 2. don't have to upload the large codebehind site DLL to fix one bug. 3. updating the codebehind site DLL restarts the application. fixing
5
3836
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 confusion veered it's ugly head :( Learning Python explains on page 324: Class Interface Techniques (21.3.3 in the ebook) the following is an extender method. ''' #################################### '''
47
3146
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 non trivial system. Is this right? should I think in use other assets as package systems, component models etc... to build something complex? did this assets exist with no cost and no OS dependence? is there an agree on the use of them in the open...
0
1719
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 Blessings from business owners are important in all SOA implementations. This article articulates the vision of reusability with a different spin around the business users, the ultimate end users of SOA.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.