Private Shared Sub InjectTraceExtensionToConfig() Dim assBase As Assembly Dim webServiceConfig As Type Dim currentProp As Object Dim propInfo As PropertyInfo Dim value As Object() Dim myType As Type Dim objArray As Object() Dim myObj As Object Dim myField As FieldInfo Try assBase = GetType(System.Web.Services.Protocols.SoapExtensionAttribute).Assembly webServiceConfig = assBase.[GetType]("System.Web.Services.Configuration.WebServicesCon figuration") If webServiceConfig Is Nothing Then Throw New Exception("Error ...") End If currentProp = webServiceConfig.GetProperty("Current").GetValue(Nothing, Nothing) propInfo = webServiceConfig.GetProperty("SoapExtensionTypes") value = DirectCast(propInfo.GetValue(currentProp, Nothing), Object()) myType = value.[GetType]().GetElementType() objArray = DirectCast(Array.CreateInstance(myType, CInt(value.Length) + 1), Object()) Array.Copy(value, objArray, CInt(value.Length)) myObj = Activator.CreateInstance(myType) myField = myType.GetField("Type") myField.SetValue(myObj, GetType(TraceExtension)) objArray(CInt(objArray.Length) - 1) = myObj propInfo.SetValue(currentProp, objArray, Nothing) Catch ex As Exception End Try End SubThe Global class is called from Global.asax:
< @ Application Language="VB" Inherits="Framework.GlobalBase"%>But, as is, it will not do anything. Something has to trigger this method. This is where I am not sure about the proper way to establish a trigger here. When this is in the web.config. the trigger is done by .NET. But, in the code, there is a missing link here.