Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / Util / Permission.cs / 1 / Permission.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * * Copyright (c) 1998-1999, Microsoft Corporation * */ namespace System.Web.Util { using System.Security.Permissions; using System.Security; using System.Data.SqlClient; static class Permission { internal static bool HasSqlClientPermission() { NamedPermissionSet permissionset = HttpRuntime.NamedPermissionSet; // If we don't have a NamedPermissionSet, we're in full trust if (permissionset == null) return true; // Check that the user has unrestricted SqlClientPermission IPermission allowedPermission = permissionset.GetPermission(typeof(SqlClientPermission)); if (allowedPermission == null) { return false; } IPermission askedPermission = null; try { askedPermission = new SqlClientPermission(PermissionState.Unrestricted); } catch { return false; } return askedPermission.IsSubsetOf(allowedPermission); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * * Copyright (c) 1998-1999, Microsoft Corporation * */ namespace System.Web.Util { using System.Security.Permissions; using System.Security; using System.Data.SqlClient; static class Permission { internal static bool HasSqlClientPermission() { NamedPermissionSet permissionset = HttpRuntime.NamedPermissionSet; // If we don't have a NamedPermissionSet, we're in full trust if (permissionset == null) return true; // Check that the user has unrestricted SqlClientPermission IPermission allowedPermission = permissionset.GetPermission(typeof(SqlClientPermission)); if (allowedPermission == null) { return false; } IPermission askedPermission = null; try { askedPermission = new SqlClientPermission(PermissionState.Unrestricted); } catch { return false; } return askedPermission.IsSubsetOf(allowedPermission); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LoginUtil.cs
- ActivityInfo.cs
- OutputCacheModule.cs
- InArgumentConverter.cs
- ReversePositionQuery.cs
- ContourSegment.cs
- ArgumentDesigner.xaml.cs
- DetailsViewRowCollection.cs
- DataSet.cs
- DocumentViewer.cs
- TreeNodeCollection.cs
- GorillaCodec.cs
- VectorAnimationUsingKeyFrames.cs
- GridSplitterAutomationPeer.cs
- TogglePatternIdentifiers.cs
- CodeExpressionStatement.cs
- DotExpr.cs
- GeometryDrawing.cs
- SqlUdtInfo.cs
- TimeSpanValidatorAttribute.cs
- ByteConverter.cs
- XmlDataSource.cs
- FileDialogCustomPlacesCollection.cs
- Block.cs
- DataSourceView.cs
- EnumValidator.cs
- BoundColumn.cs
- NestedContainer.cs
- FontUnitConverter.cs
- documentsequencetextview.cs
- InvalidPropValue.cs
- XmlTextReader.cs
- GifBitmapDecoder.cs
- RowSpanVector.cs
- StackBuilderSink.cs
- XmlNamespaceManager.cs
- ZoneMembershipCondition.cs
- ColorBuilder.cs
- ConstraintManager.cs
- ParentQuery.cs
- RIPEMD160Managed.cs
- WhitespaceRuleLookup.cs
- DataControlLinkButton.cs
- mactripleDES.cs
- XmlSchemaSimpleType.cs
- StatusBarPanel.cs
- ReflectionPermission.cs
- ServiceContractAttribute.cs
- PersianCalendar.cs
- DataObjectEventArgs.cs
- RenderingBiasValidation.cs
- ResizeGrip.cs
- SiteMapNodeCollection.cs
- MetadataArtifactLoaderCompositeResource.cs
- TreeNode.cs
- ReadOnlyHierarchicalDataSource.cs
- SqlFacetAttribute.cs
- AssertSection.cs
- IUnknownConstantAttribute.cs
- ProxyGenerationError.cs
- Matrix.cs
- WebConfigurationHostFileChange.cs
- RequestValidator.cs
- WebResourceAttribute.cs
- PhysicalAddress.cs
- WebPartHeaderCloseVerb.cs
- HttpProfileGroupBase.cs
- TrustLevelCollection.cs
- EntityEntry.cs
- FixedHyperLink.cs
- ClientSideProviderDescription.cs
- SuppressIldasmAttribute.cs
- EndpointAddressAugust2004.cs
- XmlSchemaCompilationSettings.cs
- DbConnectionClosed.cs
- SharedPerformanceCounter.cs
- ListGeneralPage.cs
- DelegateTypeInfo.cs
- GeneralTransform3D.cs
- MediaContextNotificationWindow.cs
- Grant.cs
- ConfigPathUtility.cs
- TriggerBase.cs
- PrimitiveType.cs
- Keyboard.cs
- ResourceDescriptionAttribute.cs
- TemplatedMailWebEventProvider.cs
- UnaryOperationBinder.cs
- UserMapPath.cs
- wgx_commands.cs
- ProgressBarRenderer.cs
- SettingsProviderCollection.cs
- DisplayInformation.cs
- WebServiceAttribute.cs
- DataView.cs
- ColumnReorderedEventArgs.cs
- ContainsRowNumberChecker.cs
- DataViewSetting.cs
- XmlHierarchyData.cs
- ExtensionQuery.cs