WebService.Session

xiaoxiao2021-03-06  35

Http://msdn.microsoft.com/library/cht/default.asp?url=/library/cht/cpref/html/frlrfsystemwebservicesWebServiceClassSessionTopic.asp

MSDN HOME>

.NET FRAMEWORK>

Reference>

Category Library>

System.Web.Services>

WebService Categories>

Attributes

.NET Framework Category Library

WebService.Session attribute

Obtain the current requirements of HttpSessionState.

[Visual Basic]

Public Readonly Property Session as httpsessionState

[C #]

Public httpsessionState session {get;}

[C ]

Public: __property httpsessionState * get_session ();

[Jscript]

PUBLIC FUNCTION GET session (): httpsessionState;

Attribute value

System.Web.httpSessionState, represents the ASP.NET working phase status object in the current work phase.

example

[Visual Basic, C #] The following example uses a working phase status to determine the number of times the XML Web Service method sessionhitcounter at a specific working phase. In this example, in order to obtain access to the working phase, set the webmethodattribute's EnableSession property to True.

[Visual Basic]

<% @ WebService language = "vb" class = "util"%>

Imports System.Web.Services

Public Class Util

Inherits WebService

Enablesession: = true)> _

Public Function sessionhitcounter () AS INTEGER

IF session ("Hitcounter" is nothing then

Session ("Hitcounter") = 1

Else

Session ("Hitcounter") = CINT (SESSION ("Hitcounter") 1

END IF

Return CINT ("Hitcounter"))

END FUNCTION

END CLASS

[C #]

<% @ Webservice Language = "C #" class = "Util"%>

Using system.Web.services;

Public class util: WebService {

[WebMethod (Description = "Per session hit counter", enablesession = true)]

Public int sessionhitcounter () {

IF (session ["hitcounter" == null) {

Session [Hitcounter "] = 1;

}

Else {

Session [Hitcounter "] = ((int) session [" hitcounter "]) 1;

}

Return ((int) session ["hitcounter"]);

}

}

[C , JScript] No examples of C or JScript use. To view the Visual Basic or C # example, press the [Language Filter Condition] button in the upper left corner of the screen.

demand

Platform: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series

See

WebService Category | WebService Member | System.Web.Services Namespace | HttpSessionState

Transfer your opinions on files to Microsoft

© Microsoft Corporation. All Rights Reserved.

Personal Information Center |

contact us

© 2005 Microsoft Corporation. Copyright, and retain all rights.

Use regulations |

转载请注明原文地址:https://www.9cbs.com/read-62358.html

New Post(0)