Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

AOP using System.Reflection.Emit - Code Injection IL

, 2 Jun 2006
Very often, we need to intercept method calls and enable some code to run before/after a method call of an external type (.NET object). Learn how to do this.
interceptor.zip
WinTestAspect
App.ico
bin
Debug
SadasSof.Aspects.dll
WinTestAspect.exe
obj
Debug
temp
TempPE
WinTestAspect.csproj.user
SadasSoft.Aspects
bin
Debug
SadasSof.Aspects.dll
obj
Debug
InterceptorSample.dll
temp
TempPE
Release
Sadas.Reflection.dll
temp
TempPE
SadasSof.Aspects.csproj.user
WebTestAspects
bin
EnterpriseDemo.dll
SadasSof.Aspects.dll
WebTestAspects.dll
Global.asax
WebTestAspects.csproj.webinfo
wintestaspect.zip
EnterpriseDemo.dll
SadasSof.Aspects.dll
WinTestAspect.exe
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

namespace WebTestAspects 
{
	/// <summary>
	/// Summary description for Global.
	/// </summary>
	public class Global : System.Web.HttpApplication
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		public Global()
		{
			InitializeComponent();
		}	
		
		protected void Application_Start(Object sender, EventArgs e)
		{

		}
 
		protected void Session_Start(Object sender, EventArgs e)
		{

		}

		protected void Application_BeginRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_EndRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_AuthenticateRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_Error(Object sender, EventArgs e)
		{

		}

		protected void Session_End(Object sender, EventArgs e)
		{

		}

		protected void Application_End(Object sender, EventArgs e)
		{

		}
			
		#region Web Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.components = new System.ComponentModel.Container();
		}
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Roberto Loreto
Web Developer
Spain Spain
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 2 Jun 2006
Article Copyright 2006 by Roberto Loreto
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid