Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / HttpModule.cs / 1 / HttpModule.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System.Threading; using System.ServiceModel; using System.Web; using System.Web.Hosting; using System.Security; using System.Security.Permissions; using System.Diagnostics; class HttpModule : IHttpModule { static bool disabled; ////// RequiresReview - called outside PermitOnly context, /// [SecurityRequiresReview] public void Dispose() { } ////// Critical - entry-point from asp.net, accesses ProcessRequest which is SecurityCritical /// [SecurityCritical] public void Init(HttpApplication context) { context.PostAuthenticateRequest += new EventHandler(ProcessRequest); } ////// Critical - Entry-point from asp.net, called outside PermitOnly context /// ASP calls are critical /// HostedHttpRequestAsyncResult..ctor is critical because it captures HostedImpersonationContext /// (and makes it available later) so caller must ensure that this is called in the right place /// [SecurityCritical] static void ProcessRequest(object sender, EventArgs e) { if (HttpModule.disabled) { return; } try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { HttpModule.disabled = true; if (DiagnosticUtility.ShouldTraceWarning) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); } // If requesting a .svc file, the HttpHandler will try to handle it. It will call // SafeEnsureInitialized() again, which will fail with the same exception (it is // idempotent on failure). This is the correct behavior. return; } if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { return; } // Check to see whether the extension is supported HttpApplication application = (HttpApplication)sender; string extension = System.IO.Path.GetExtension(application.Request.FilePath); if (extension == null || !ServiceHostingEnvironment.GetExtensionSupported(extension)) { return; } HostedHttpRequestAsyncResult.ExecuteSynchronous(application, false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PrivilegedConfigurationManager.cs
- InfoCardMasterKey.cs
- cookiecollection.cs
- ItemChangedEventArgs.cs
- ErrorFormatter.cs
- RepeaterItemEventArgs.cs
- EnterpriseServicesHelper.cs
- XmlArrayAttribute.cs
- XmlQueryCardinality.cs
- DbProviderFactoriesConfigurationHandler.cs
- PackWebRequest.cs
- Compilation.cs
- QilGeneratorEnv.cs
- RelationshipEnd.cs
- FatalException.cs
- StopRoutingHandler.cs
- InsufficientMemoryException.cs
- RenderContext.cs
- ClientScriptItem.cs
- ClientTarget.cs
- Rect3D.cs
- CurrentChangingEventArgs.cs
- SettingsPropertyWrongTypeException.cs
- Compilation.cs
- SqlInternalConnectionTds.cs
- WebPartCancelEventArgs.cs
- indexingfiltermarshaler.cs
- EncodingNLS.cs
- FunctionUpdateCommand.cs
- ColorConverter.cs
- IListConverters.cs
- ArgIterator.cs
- DataGridViewCellStateChangedEventArgs.cs
- CssStyleCollection.cs
- AsymmetricSignatureFormatter.cs
- WeakHashtable.cs
- TypeDependencyAttribute.cs
- UnionExpr.cs
- BufferedGenericXmlSecurityToken.cs
- InvalidProgramException.cs
- BeginStoryboard.cs
- SQLBoolean.cs
- ISO2022Encoding.cs
- unsafenativemethodstextservices.cs
- AsyncCompletedEventArgs.cs
- ExpressionBuilder.cs
- AppDomainShutdownMonitor.cs
- BitmapEffectInputConnector.cs
- InvalidProgramException.cs
- DateTimeValueSerializer.cs
- ColorEditor.cs
- TabletDeviceInfo.cs
- StoreAnnotationsMap.cs
- ProgressBar.cs
- InstanceHandleConflictException.cs
- GestureRecognizer.cs
- SourceFilter.cs
- IERequestCache.cs
- VectorAnimationUsingKeyFrames.cs
- TreeNodeCollectionEditor.cs
- XmlText.cs
- ProfileSection.cs
- TabControlCancelEvent.cs
- DataBoundControl.cs
- TemplateNodeContextMenu.cs
- DropDownButton.cs
- CollectionContainer.cs
- PageParser.cs
- Pointer.cs
- Boolean.cs
- SerializationEventsCache.cs
- SingleObjectCollection.cs
- ProfileEventArgs.cs
- RealProxy.cs
- AsyncWaitHandle.cs
- ClientSession.cs
- ToolStripPanelRow.cs
- AppearanceEditorPart.cs
- StylusPointCollection.cs
- ThreadPool.cs
- OneOfElement.cs
- ISFTagAndGuidCache.cs
- LostFocusEventManager.cs
- ContentOperations.cs
- SystemIPInterfaceProperties.cs
- VirtualDirectoryMapping.cs
- CatalogZoneBase.cs
- TypeForwardedToAttribute.cs
- ConfigurationManagerInternal.cs
- DesignSurfaceServiceContainer.cs
- DataViewListener.cs
- CustomWebEventKey.cs
- ObjectParameterCollection.cs
- CustomAttributeFormatException.cs
- DelimitedListTraceListener.cs
- LinkArea.cs
- CodeSubDirectoriesCollection.cs
- peersecurityelement.cs
- ImageConverter.cs
- SecureUICommand.cs