This documentation is archived and is not being maintained.
RemotingServices::Connect Method (Type, String)
Visual Studio 2010
Creates a proxy for a well-known object, given the Type and URL.
Assembly: mscorlib (in mscorlib.dll)
[ComVisibleAttribute(true)] public: static Object^ Connect( Type^ classToProxy, String^ url )
Parameters
- classToProxy
- Type: System::Type
The Type of a well-known object on the server end to which you want to connect.
- url
- Type: System::String
The URL of the server class.
Return Value
Type: System::ObjectA proxy to the remote object that points to an endpoint served by the specified well-known object.
| Exception | Condition |
|---|---|
| SecurityException | The immediate caller does not have permission to configure remoting types and channels. |
The following code example demonstrates how to use the Connect method to create a proxy to a well-known object.
Console::WriteLine( "Connecting to SampleNamespace::SampleWellKnown." ); SampleWellKnown ^ proxy = dynamic_cast<SampleWellKnown^>(RemotingServices::Connect( SampleWellKnown::typeid, const_cast<String^>(SERVER_URL) )); Console::WriteLine( "Connected to SampleWellKnown" ); // Verifies that the Object* reference is to a transparent proxy. if ( RemotingServices::IsTransparentProxy( proxy ) ) Console::WriteLine( "proxy is a reference to a transparent proxy." ); else Console::WriteLine( "proxy is not a transparent proxy. This is unexpected." ); // Calls a method on the server Object*. Console::WriteLine( "proxy->Add returned {0}.", proxy->Add( 2, 3 ) );
- SecurityPermission
for configuration of the remoting infrastructure. Demand value: SecurityAction::LinkDemand; Permission value: SecurityPermissionFlag::RemotingConfiguration
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: