Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a property in a Web Service
Message
De
19/05/2003 15:03:17
 
 
À
19/05/2003 14:59:18
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Divers
Thread ID:
00790056
Message ID:
00790102
Vues:
20
>What you're trying to do here can be done with global variables. In .NET Web Services you declare them at the class level (outside of any functions), you can initialize them in the constructor and then you can use them from any function. You would only need to expose them as properties if you needed to access them from other classes.

So far, I have this:
Public Class WebService
    Inherits System.Web.Services.WebService

    Private cUrl As String = "http://www.levelextreme.com"
    Private cUser As String = ""

    <WebMethod()> _
    Public Function HelloWorld(ByVal tcString As String) As String
        Return tcString + cUrl + cUser
    End Function

End Class
What surprises me is that I was not able to do this:
Public Class WebService
    Inherits System.Web.Services.WebService

    Private cUrl As String
    Private cUser As String

    cUrl="http://www.levelextreme.com"
    cUser=""

    <WebMethod()> _
    Public Function HelloWorld(ByVal tcString As String) As String
        Return tcString + cUrl + cUser
    End Function

End Class
Do you know why?
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform