Bewerken

Delen via


UnauthorizedWebPart Constructors

Definition

Initializes property data for a new instance of an UnauthorizedWebPart control.

Overloads

UnauthorizedWebPart(WebPart)

Initializes a new instance of an UnauthorizedWebPart control, called when a static WebPart control (or server or user control) fails authorization.

UnauthorizedWebPart(String, String, String, String)

Initializes a new instance of an UnauthorizedWebPart control, called when a dynamic WebPart control (or server or user control) fails authorization.

Remarks

The UnauthorizedWebPart constructor, in both of its overloads, calls base constructors in the ProxyWebPart class. These constructors each initialize property data and create a new instance of an UnauthorizedWebPart control.

When the WebPartManager control is adding WebPart controls (and other server or user controls) to its collection of controls, it checks each control using the IsAuthorized method. If a control instance is not authorized, certain property values from the control (such as its ID) are assigned to properties in a new UnauthorizedWebPart control, and the UnauthorizedWebPart control is then added to the control tree of the page in place of the control that failed authorization.

An UnauthorizedWebPart control is never rendered in a page, and a user has no way of knowing it is there. However, an UnauthorizedWebPart control also acts as a placeholder, maintaining the position of the original control in the control tree, and maintaining any preexisting personalization data for the original control. That way, if a user previously personalized a control, it then becomes unauthorized for some reason, and later it is authorized again, the user's personalization data can be restored.

UnauthorizedWebPart(WebPart)

Initializes a new instance of an UnauthorizedWebPart control, called when a static WebPart control (or server or user control) fails authorization.

public:
 UnauthorizedWebPart(System::Web::UI::WebControls::WebParts::WebPart ^ webPart);
public UnauthorizedWebPart (System.Web.UI.WebControls.WebParts.WebPart webPart);
new System.Web.UI.WebControls.WebParts.UnauthorizedWebPart : System.Web.UI.WebControls.WebParts.WebPart -> System.Web.UI.WebControls.WebParts.UnauthorizedWebPart
Public Sub New (webPart As WebPart)

Parameters

webPart
WebPart

A WebPart that has failed to be authorized by the WebPartManager control.

Remarks

The UnauthorizedWebPart constructor takes a static control webPart as a parameter, where webPart has failed an authorization check. A static control is one that is declared in the markup of a Web page, rather than being added programmatically. The constructor returns a new instance of an UnauthorizedWebPart control, which is added to the page's control tree in place of webPart. For more information, see UnauthorizedWebPart.

See also

Applies to

UnauthorizedWebPart(String, String, String, String)

Initializes a new instance of an UnauthorizedWebPart control, called when a dynamic WebPart control (or server or user control) fails authorization.

public:
 UnauthorizedWebPart(System::String ^ originalID, System::String ^ originalTypeName, System::String ^ originalPath, System::String ^ genericWebPartID);
public UnauthorizedWebPart (string originalID, string originalTypeName, string originalPath, string genericWebPartID);
new System.Web.UI.WebControls.WebParts.UnauthorizedWebPart : string * string * string * string -> System.Web.UI.WebControls.WebParts.UnauthorizedWebPart
Public Sub New (originalID As String, originalTypeName As String, originalPath As String, genericWebPartID As String)

Parameters

originalID
String

A string that contains the ID of the original server or user control that was added to a WebPartZoneBase to participate in a Web Parts application.

originalTypeName
String

A string containing the name of the original control's type.

originalPath
String

A string containing the relative virtual path to the user control, if the original control is a user control.

genericWebPartID
String

A string containing the ID of the GenericWebPart control that wraps the original server or user control.

Remarks

The UnauthorizedWebPart constructor is called when a dynamic WebPart or other server control fails its authorization check. A dynamic control is one that is added to a page programmatically, or by a user from a catalog of Web Parts controls. The UnauthorizedWebPart constructor returns a new instance of an UnauthorizedWebPart control to replace the dynamic control that failed authorization. For more information, see UnauthorizedWebPart.

See also

Applies to