Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / RunTime / Hosting / WorkflowWebHostingModule.cs / 1305376 / WorkflowWebHostingModule.cs
/******************************************************************************** // Copyright (C) 2000-2001 Microsoft Corporation. All rights reserved. // // CONTENTS // Workflow Web Hosting Module. // DESCRIPTION // Implementation of Workflow Web Host Module. // REVISIONS // Date Ver By Remarks // ~~~~~~~~~~ ~~~ ~~~~~~~~ ~~~~~~~~~~~~~~ // 02/22/05 1.0 [....] Implementation. * ****************************************************************************/ #region Using directives using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Web; using System.Collections.Specialized; using System.Threading; #endregion namespace System.Workflow.Runtime.Hosting { ////// Cookie based rotuing module implementation /// public sealed class WorkflowWebHostingModule : IHttpModule { HttpApplication currentApplication; public WorkflowWebHostingModule() { WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "Workflow Web Hosting Module Created"); } ////// IHttpModule.Init() /// /// void IHttpModule.Init(HttpApplication application) { WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "Workflow Web Hosting Module Initialized"); this.currentApplication = application; //Listen for Acquire and ReleaseRequestState event application.ReleaseRequestState += this.OnReleaseRequestState; application.AcquireRequestState += this.OnAcquireRequestState; } void IHttpModule.Dispose() { } void OnAcquireRequestState(Object sender, EventArgs e) { //Performs Cookie based routing. WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "WebHost Module Routing Begin"); HttpCookie routingCookie = HttpContext.Current.Request.Cookies.Get("WF_WorkflowInstanceId"); if (routingCookie != null) { HttpContext.Current.Items.Add("__WorkflowInstanceId__", new Guid(routingCookie.Value)); } //else no routing information found, it could be activation request or non workflow based request. } void OnReleaseRequestState(Object sender, EventArgs e) { //Saves cookie back to client. HttpCookie cookie = HttpContext.Current.Request.Cookies.Get("WF_WorkflowInstanceId"); if (cookie == null) { cookie = new HttpCookie("WF_WorkflowInstanceId"); Object workflowInstanceId = HttpContext.Current.Items["__WorkflowInstanceId__"]; if (workflowInstanceId != null) { cookie.Value = workflowInstanceId.ToString(); HttpContext.Current.Response.Cookies.Add(cookie); } } } } } // 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
- ToolBar.cs
- ConfigWriter.cs
- XmlResolver.cs
- Timer.cs
- BuilderInfo.cs
- DateTimeOffsetAdapter.cs
- CheckoutException.cs
- SimpleBitVector32.cs
- ProfileParameter.cs
- CommonProperties.cs
- DateRangeEvent.cs
- SkewTransform.cs
- XPathPatternBuilder.cs
- WebConvert.cs
- ApplicationHost.cs
- Clock.cs
- MessageSmuggler.cs
- InternalConfigHost.cs
- XmlNodeComparer.cs
- String.cs
- SqlUserDefinedAggregateAttribute.cs
- Debug.cs
- UpDownBase.cs
- SqlDataRecord.cs
- TextFindEngine.cs
- GlyphCollection.cs
- FeatureSupport.cs
- Processor.cs
- EntityDataSourceDesignerHelper.cs
- PageFunction.cs
- ContractSearchPattern.cs
- ScopedKnownTypes.cs
- SrgsElementFactoryCompiler.cs
- DecimalKeyFrameCollection.cs
- SqlNotificationRequest.cs
- SqlConnection.cs
- ToolboxItemAttribute.cs
- SqlRetyper.cs
- XpsImage.cs
- Annotation.cs
- CompiledRegexRunner.cs
- Configuration.cs
- PropertyPathWorker.cs
- XhtmlStyleClass.cs
- NativeMethods.cs
- WindowsTooltip.cs
- InvalidWorkflowException.cs
- ItemsPresenter.cs
- OleDbInfoMessageEvent.cs
- ForwardPositionQuery.cs
- TdsParserSessionPool.cs
- UriSection.cs
- HostedImpersonationContext.cs
- ADRoleFactory.cs
- ProcessInputEventArgs.cs
- _IPv4Address.cs
- SvcFileManager.cs
- AffineTransform3D.cs
- SafeFindHandle.cs
- SqlDataSourceSelectingEventArgs.cs
- ThrowHelper.cs
- StrongNameSignatureInformation.cs
- RelatedCurrencyManager.cs
- TextBox.cs
- StatusInfoItem.cs
- X509Utils.cs
- LayoutUtils.cs
- XsdCachingReader.cs
- ConsoleKeyInfo.cs
- ToolStripDropDownButton.cs
- StringValidator.cs
- OciEnlistContext.cs
- WebPartConnectionsDisconnectVerb.cs
- GeneralTransform.cs
- RectIndependentAnimationStorage.cs
- LifetimeMonitor.cs
- SqlProcedureAttribute.cs
- ChineseLunisolarCalendar.cs
- DataGridViewCellPaintingEventArgs.cs
- SchemaSetCompiler.cs
- DeclarationUpdate.cs
- ToolStripDropDown.cs
- Rectangle.cs
- COM2IProvidePropertyBuilderHandler.cs
- StorageEntityContainerMapping.cs
- MenuItemStyle.cs
- WebPartUtil.cs
- RuntimeConfigurationRecord.cs
- UriTemplate.cs
- MobileTemplatedControlDesigner.cs
- ReservationNotFoundException.cs
- UrlUtility.cs
- SchemaImporterExtensionElement.cs
- TreeViewItem.cs
- _OSSOCK.cs
- MachineKeyValidationConverter.cs
- SoapElementAttribute.cs
- HandledMouseEvent.cs
- WebPartZoneBaseDesigner.cs
- FrameSecurityDescriptor.cs