Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Application_Start() but only for Web Service
Message
De
28/01/2015 10:46:36
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Application_Start() but only for Web Service
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01614485
Message ID:
01614485
Vues:
25
My Global.asax file is containing only one line which forwards to my framework Global class the role to set up everything. The Global.asax, either for the Web or for the Web Service, will call the Global class. This contains code that is subject to IIS, the application pool and so on. Today, I added the Application_Start() event to load something. But, I only need to load that when I am from a Web Service environment.

Here is a brief look at the main sections for the code of the Global class:
Imports System.Web
Imports System.Reflection

Public Class GlobalBase
    Inherits System.Web.HttpApplication

    Private oApp As App = Nothing

    Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
    End Sub

    Sub Application_Start()
        RegisterSoapExtension(GetType(TraceExtension), 1, 0)
    End Sub

    Sub Application_End()
    End Sub

    <System.Security.Permissions.ReflectionPermission(System.Security.Permissions.SecurityAction.Demand, Unrestricted:=True)> _
    Public Shared Sub RegisterSoapExtension(type As Type, priority As Integer, group As System.Web.Services.Configuration.PriorityGroup)
    End Sub

End Class
How can I make sure the Application_Start() will only execute RegisterSoapExtension() when I am running under a Web Service? Because I assume this will conflict if being run under a Web site or will be useless.

We are running under the System.Web.HttpApplication class. Is there something in there letting us about that?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform