System.Security.Policy.Site Class

Assembly: Mscorlib.dll
Namespace: System.Security.Policy
Summary
Provides the Web site from which a code assembly originates as evidence for policy evaluation. This class cannot be inherited.
C# Syntax:
[Serializable]
public sealed class Site : IIdentityPermissionFactory
Remarks
The presence of Site evidence produces a SiteIdentityPermission in the grant set. If there is a CodeAccessPermission.Demand for SiteIdentityPermission, the SiteIdentityPermission that corresponds to the Site evidence will be compared with the demanded permission.

Site identity is defined for code from URLs with any protocol except FILE. A site is the string between the "//" after the protocol of a URL and the following "/", if present. For example, www.fourthcoffee.com is the site identity in the URL http://www.fourthcoffee.com/process/grind.htm. This excludes port numbers. If a given URL is http://www.fourthcoffee.com:8000/, the site is www.fourthcoffee.com , not www.fourthcoffee.com:8000.

See also:
System.Security.Policy Namespace

System.Security.Policy.Site Member List:

Public Constructors
ctor #1 Initializes a new instance of the Site class with the Web site from which a code assembly originates.
Public Properties
Name Read-only

Gets the site from which the code assembly originates.
Public Methods
Copy Creates an equivalent copy of the Site.
CreateFromUrl Creates a new Site from the specified URL.
CreateIdentityPermission Creates an identity permission that corresponds to the current Site.
Equals Overridden:
Compares the current Site to the specified object for equivalence.
GetHashCode Overridden:
Returns the hash code of the current Web site name.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overridden:
Returns a string representation of the current Site.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Security.Policy.Site Member Details

ctor #1
Summary
Initializes a new instance of the Site class with the Web site from which a code assembly originates.
C# Syntax:
public Site(
   string name
);
Parameters:

name

The Web site of origin for the associated code assembly.

Exceptions
Exception Type Condition
ArgumentNullException The name parameter is null.
ArgumentException The name parameter is not a valid Site.

Return to top


Property: Name (read-only)
Summary
Gets the site from which the code assembly originates.
C# Syntax:
public string Name {get;}

Return to top


Method: Copy()
Summary
Creates an equivalent copy of the Site.
C# Syntax:
public object Copy();
Return Value:
A new, identical copy of the Site.

Return to top


Method: CreateFromUrl(
   string url
)
Summary
Creates a new Site from the specified URL.
C# Syntax:
public static Site CreateFromUrl(
   string url
);
Parameters:

url

The URL from which to create the new Site.

Return Value:
The new Site.
Exceptions
Exception Type Condition
ArgumentException The url parameter is not a valid URL.

Return to top


Method: CreateIdentityPermission(
   Evidence evidence
)
Summary
Creates an identity permission that corresponds to the current Site.
C# Syntax:
public IPermission CreateIdentityPermission(
   Evidence evidence
);
Parameters:

evidence

The Evidence from which to construct the identity permission.

Return Value:
A SiteIdentityPermission for the specified Site.
Implements:
IIdentityPermissionFactory.CreateIdentityPermission

Return to top


Overridden Method: Equals(
   object o
)
Summary
Compares the current Site to the specified object for equivalence.
C# Syntax:
public override bool Equals(
   object o
);
Parameters:

o

The Site to test for equivalence with the current object.

Return Value:
true if the two instances of the Site class are equal; otherwise, false.
Exceptions
Exception Type Condition
ArgumentException The o parameter is not a Site object.
Remarks
Site objects are equal if they designate the same Web site name.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~Site();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: GetHashCode()
Summary
Returns the hash code of the current Web site name.
C# Syntax:
public override int GetHashCode();
Return Value:
The hash code of the current Web site name.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Returns a string representation of the current Site.
C# Syntax:
public override string ToString();
Return Value:
A representation the current Site.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.