punjabtechnicaluniversity.blogspot.in
OR How can we maintain State in Webservices ?
<%@ Webservice class="TestWebServiceClass" %>
Imports System.Web.Services
Public class TestWebServiceClass
Inherits WebService
<WebMethod> Public Sub SetSession(value As String)
session("Val") = Value
End Sub
end class
OR How can we maintain State in Webservices ?
Webservices as such do not have any mechanism by which they can maintain state.Webservices can access ASP.NET intrinsic objects like Session , application etc. if they inherit from “WebService” base class.
<%@ Webservice class="TestWebServiceClass" %>
Imports System.Web.Services
Public class TestWebServiceClass
Inherits WebService
<WebMethod> Public Sub SetSession(value As String)
session("Val") = Value
End Sub
end class
Above is a sample code which sets as session object calles as “val”. TestWebserviceClass is inheriting from WebService to access the session and application objects.
0 comments:
Post a Comment
North India Campus