Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
944
|
Chapter 17: Security
When creating the PrincipalPermissions as part of the object construction, you are
using string representations of the built-in objects (
"BUILTIN\Administrators") to set
up the principal role. However, the names of these objects may be different depend-
ing on the locale the code runs under. It would be appropriate to use the
WindowsAccountType.Administrator enumeration value to ease localization since this
public void RefreshData( )
{
try
{
admPerm.Union(powerPerm.Union(userPerm)).Demand( );
Startup( );
Console.WriteLine("[SECPROXY] Data Refreshed");
coData.RefreshData( );
}
catch(SecurityException e)
{
Console.WriteLine("RefreshData Failed! {0}",e.ToString( ));
}
}
public void SaveNewData( )
{
try
{
admPerm.Union(powerPerm).Demand( );
Startup( );
Console.WriteLine("[SECPROXY] Data Saved");
coData.SaveNewData( );
}
catch(SecurityException e)
{
Console.WriteLine("SaveNewData Failed! {0}",e.ToString( ));
}
}
// DO NOT forget to use [#define DOTRACE] to control the tracing proxy.
private void Startup( )
{
if (coData == null)
{
#if (DOTRACE)
coData = new CompanyDataTraceProxy( );
#else
coData = new CompanyData( );
#endif
Console.WriteLine("[SECPROXY] Refresh Data");
coData.RefreshData( );
}
}
}
Example 17-3. CompanyDataSecProxy security proxy class (continued) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata