Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / IntranetCredentialPolicy.cs / 1 / IntranetCredentialPolicy.cs
namespace Microsoft.Win32 { using System; using System.Net; using System.Globalization; using System.IO; using System.Security.Permissions; using System.Security.Principal; using System.ComponentModel; using System.Text; using System.Runtime.InteropServices; // IID_IInternetSecurityManager = 79eac9ee-baf9-11ce-8c82-00aa004ba90b // IID_IInternetZoneManager = 79eac9ef-baf9-11ce-8c82-00aa004ba90b // CLSID_InternetSecurityManager= 7b8a2d94-0ac9-11d1-896c-00c04Fb6bfc4 // CLSID_InternetZoneManager = 7b8a2d95-0ac9-11d1-896c-00c04Fb6bfc4 [ComImport, ComVisible(false), Guid("7b8a2d94-0ac9-11d1-896c-00c04Fb6bfc4")] internal class InternetSecurityManager { } [ComImport, ComVisible(false), Guid("79eac9ee-baf9-11ce-8c82-00aa004ba90b"), System.Runtime.InteropServices.InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IInternetSecurityManager { unsafe void SetSecuritySite( void *pSite); unsafe void GetSecuritySite( /* [out] */ void **ppSite); [System.Security.SuppressUnmanagedCodeSecurity] void MapUrlToZone( [In, MarshalAs(UnmanagedType.BStr)] string pwszUrl, [Out] out int pdwZone, [In] int dwFlags); unsafe void GetSecurityId( /* [in] */ string pwszUrl, /* [size_is][out] */ byte *pbSecurityId, /* [out][in] */ int *pcbSecurityId, /* [in] */ int dwReserved); unsafe void ProcessUrlAction( /* [in] */ string pwszUrl, /* [in] */ int dwAction, /* [size_is][out] */ byte *pPolicy, /* [in] */ int cbPolicy, /* [in] */ byte *pContext, /* [in] */ int cbContext, /* [in] */ int dwFlags, /* [in] */ int dwReserved); unsafe void QueryCustomPolicy( /* [in] */ string pwszUrl, /* [in] */ /*REFGUID*/ void *guidKey, /* [size_is][size_is][out] */ byte **ppPolicy, /* [out] */ int *pcbPolicy, /* [in] */ byte *pContext, /* [in] */ int cbContext, /* [in] */ int dwReserved); unsafe void SetZoneMapping( /* [in] */ int dwZone, /* [in] */ string lpszPattern, /* [in] */ int dwFlags); unsafe void GetZoneMappings( /* [in] */ int dwZone, /* [out] */ /*IEnumString*/ void **ppenumString, /* [in] */ int dwFlags); } public class IntranetZoneCredentialPolicy: ICredentialPolicy { private const int URLZONE_INTRANET = 1; IInternetSecurityManager _ManagerRef; public IntranetZoneCredentialPolicy() { ExceptionHelper.ControlPolicyPermission.Demand(); _ManagerRef = (IInternetSecurityManager)new InternetSecurityManager(); } // // Make an interop call into UriMon // authModule and credential parameters are not considered // public virtual bool ShouldSendCredential(Uri challengeUri, WebRequest request, NetworkCredential credential, IAuthenticationModule authModule) { int pdwZone; _ManagerRef.MapUrlToZone(challengeUri.AbsoluteUri, out pdwZone, 0); return pdwZone == URLZONE_INTRANET; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AffineTransform3D.cs
- TextSimpleMarkerProperties.cs
- X509Extension.cs
- Peer.cs
- Size.cs
- CqlBlock.cs
- MessageQueueKey.cs
- MetadataCache.cs
- Vector3D.cs
- HttpListenerContext.cs
- BooleanConverter.cs
- EdmTypeAttribute.cs
- VersionPair.cs
- ContentAlignmentEditor.cs
- ValidateNames.cs
- ComponentManagerBroker.cs
- SourceFileInfo.cs
- SecurityTokenResolver.cs
- XPathMultyIterator.cs
- HttpUnhandledOperationInvoker.cs
- BrowserDefinitionCollection.cs
- ExternalException.cs
- BrowserDefinition.cs
- SemaphoreFullException.cs
- ColumnResult.cs
- WindowsTokenRoleProvider.cs
- SerialPinChanges.cs
- ImmutableCollection.cs
- WebServiceData.cs
- FixedSOMLineCollection.cs
- DataKeyCollection.cs
- FormsAuthenticationUserCollection.cs
- Misc.cs
- GridViewRowCollection.cs
- DataSet.cs
- NamespaceQuery.cs
- DataProtection.cs
- MediaPlayer.cs
- ErrorHandler.cs
- SettingsPropertyValue.cs
- TypefaceMetricsCache.cs
- TextLine.cs
- ServiceNameElement.cs
- TimeZone.cs
- SimpleApplicationHost.cs
- HttpValueCollection.cs
- ErrorHandler.cs
- Matrix3D.cs
- XomlCompilerResults.cs
- RadioButtonRenderer.cs
- EastAsianLunisolarCalendar.cs
- ProfileManager.cs
- ScopelessEnumAttribute.cs
- Converter.cs
- DefaultMemberAttribute.cs
- DocumentViewerBase.cs
- UIElementPropertyUndoUnit.cs
- DesignerTransactionCloseEvent.cs
- BookmarkScope.cs
- WindowsAuthenticationModule.cs
- WebInvokeAttribute.cs
- UIAgentCrashedException.cs
- InheritanceAttribute.cs
- NameTable.cs
- SqlBulkCopyColumnMappingCollection.cs
- Image.cs
- AdCreatedEventArgs.cs
- CalendarDataBindingHandler.cs
- CodeVariableReferenceExpression.cs
- DefinitionUpdate.cs
- TextServicesDisplayAttribute.cs
- EastAsianLunisolarCalendar.cs
- BulletDecorator.cs
- SHA1.cs
- DataObject.cs
- ScriptRef.cs
- DescriptionAttribute.cs
- SaveCardRequest.cs
- sqlpipe.cs
- DBDataPermission.cs
- XPathBuilder.cs
- UserValidatedEventArgs.cs
- XmlMembersMapping.cs
- elementinformation.cs
- ForceCopyBuildProvider.cs
- SqlRetyper.cs
- SetStateEventArgs.cs
- WebPartEditorCancelVerb.cs
- ObfuscateAssemblyAttribute.cs
- DictionaryManager.cs
- HebrewCalendar.cs
- DetailsViewPageEventArgs.cs
- FieldMetadata.cs
- ThreadStaticAttribute.cs
- PerformanceCounterManager.cs
- ReferencedCollectionType.cs
- WindowsGraphics.cs
- GridEntry.cs
- ThreadPool.cs
- EventTrigger.cs