Compartilhar via


Client vs. Server Runtime Rules

A Web Part can execute interfaces on the client, the server, or both. Interfaces are always implemented on the server, although their code and logic can exist on the client. Web Parts can implement both the server and client versions of the appropriate interfaces.

The following run-time rules describe how the infrastructure manages server-side and client-side Web Part connection interfaces at run-time:

  • All Web Parts in a connection chain (a connected Web Part and all the Web Parts connected to it) must run in the same location—all on the client, or all on the server.

  • The Web Part infrastructure calls into the CanRunAt method for each part in a connection chain to determine where the part can run. To run on the client, every Web Part in the chain must be able to run on the client; to run on the server, every Web Part in the chain must be able to run on the server. Any part of the chain that does not conform disables the whole chain of Web Parts.

  • When a Web Part Page is rendered in an unsupported browser, client-side connections are disabled, including any parts to which the Web Part Page is connected. An error message is returned, identifying the Web Part that could not run on the client.

    Connection interfaces that can run on both the server and the client and are free (that is, they are currently unconnected, or connected to a chain of parts that also run on both the server and the client) default to running on the server.

  • When a Web Part Page is rendered in a supported browser, both server-side and client-side connections are enabled.

    Connection interfaces that can run on both the server and the client and are free default to running on the client.

  • If connection interfaces that can run on both the server and the client are free but cannot run on a particular client, they default to running as server-side connections along with any connections to which the part is connected.

Note  It is not necessary for a part to check for JScript support, since the Web Part infrastructure doesn't work correctly if it's not on the browser. Most server Web Parts that only emit HTML 3.2 and minimal JScript should return ConnectionRunAt.Server without checking the browser capabilities.

For information about browser support, see Web Part Client Support. For more information about connectable Web Parts, see Creating a Connectable Web Part.