Export (0) Print
Expand All

RemotingServices.GetObjectUri Method

Retrieves the URI for the specified object.

[Visual Basic]
Public Shared Function GetObjectUri( _
   ByVal obj As MarshalByRefObject _
) As String
[C#]
public static string GetObjectUri(
 MarshalByRefObject obj
);
[C++]
public: static String* GetObjectUri(
 MarshalByRefObject* obj
);
[JScript]
public static function GetObjectUri(
   obj : MarshalByRefObject
) : String;

Parameters

obj
The MarshalByRefObject for which a URI is requested.

Return Value

The URI of the specified object if it has one, or a null reference (Nothing in Visual Basic) if the object has not yet been marshaled.

Exceptions

Exception Type Condition
SecurityException The immediate caller does not have infrastructure permission.

Example

[Visual Basic] 
Dim proxy As RealProxy = RemotingServices.GetRealProxy(obj)
Console.WriteLine("Real proxy type: {0}", proxy.GetProxiedType().ToString())

Console.WriteLine("Object URI: {0}", RemotingServices.GetObjectUri(obj).ToString())

Dim msgSink As IMessageSink = RemotingServices.GetEnvoyChainForProxy(obj).NextSink

[C#] 
RealProxy proxy = RemotingServices.GetRealProxy(obj);
Console.WriteLine("Real proxy type: {0}", proxy.GetProxiedType().ToString());

Console.WriteLine("Object URI: {0}", RemotingServices.GetObjectUri(obj).ToString());

IMessageSink  msgSink = RemotingServices.GetEnvoyChainForProxy(obj).NextSink;

[C++] 
RealProxy* proxy = RemotingServices::GetRealProxy(obj);
Console::WriteLine(S"Real proxy type: {0}", proxy->GetProxiedType());

Console::WriteLine(S"Object URI: {0}", RemotingServices::GetObjectUri(obj));

IMessageSink* msgSink = RemotingServices::GetEnvoyChainForProxy(obj)->NextSink;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

RemotingServices Class | RemotingServices Members | System.Runtime.Remoting Namespace

Show:
© 2014 Microsoft