This documentation is archived and is not being maintained.

IStackWalk.Demand Method

Determines at run time whether all callers in the call stack have been granted the permission specified by the current permission object.

[Visual Basic]
Sub Demand()
[C#]
void Demand();
[C++]
void Demand();
[JScript]
function Demand();

Exceptions

Exception Type Condition
SecurityException A caller higher in the call stack does not have the permission specified by the current permission object.

-or-

A caller in the call stack has called Deny on the current permission object.

Remarks

This method is typically used by secure libraries to ensure that callers have permission to access a resource. For example, a file class in a secure class library calls Demand for the necessary FileIOPermission before performing a file operation requested by the caller.

The permissions of the code that calls this method are not examined; the check begins from the immediate caller of that code and proceeds up the stack. Demand succeeds only if no SecurityException is raised.

Requirements

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

See Also

IStackWalk Interface | IStackWalk Members | System.Security Namespace | Security Demands

Show: