Share via


Generated Proxy Classes defaultUserContext Property

Gets or sets the default user context for the generated proxy class and its instances. This property exists at run time after the proxy class has been generated by the server.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

// Syntax for the generated proxy class.
var userContext = MyNameSpace.MyServiceProxy.get_defaultUserContext(); 
MyNameSpace.MyServiceProxy.set_defaultUserContext(value);

// Syntax for a proxy instance.
var userContext = myServiceProxy.get_defaultUserContext(); 
myServiceProxy.set_defaultUserContext(value);

Parameters

Parameter

Description

value

The user context information that is associated with the Web service call. value can be null, any primitive type, or a JavaScript object.

Return Value

The user context information that is associated with the Web service request, if any; otherwise, null.

Remarks

The user context object can be passed as a parameter to the succeeded or failed callback functions during any call to a Web service method. For more information, see Generated Proxy Classes Succeeded Callback Function and Generated Proxy Classes Failed Callback Function.

If you pass a user context when you call a Web service method, the passed value overrides the value that is set by using the defaultUserContext property.

Example

The following example shows how to set and get the defaultUserContext property for the generated proxy class and for a proxy instance.

See Also

Concepts

Sys.Net.WebServiceProxy Class

Reference

Generated Proxy Classes Succeeded Callback Function

Generated Proxy Classes Failed Callback Function