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
- BindingCollectionElement.cs
- StoryFragments.cs
- ToolBarButtonDesigner.cs
- BlurEffect.cs
- TemplateXamlTreeBuilder.cs
- Boolean.cs
- exports.cs
- DesignerObject.cs
- XmlNotation.cs
- XmlSerializationWriter.cs
- KeyedCollection.cs
- Overlapped.cs
- XmlCharType.cs
- DocumentPage.cs
- wgx_render.cs
- DictionaryBase.cs
- CodeCompiler.cs
- DataTableReader.cs
- MimeMultiPart.cs
- GridViewColumnHeader.cs
- ReliableSession.cs
- CallbackValidator.cs
- AbstractExpressions.cs
- SqlGatherConsumedAliases.cs
- ForceCopyBuildProvider.cs
- StreamGeometryContext.cs
- DnsPermission.cs
- MdiWindowListStrip.cs
- BrushMappingModeValidation.cs
- ListControl.cs
- UnsafeNativeMethods.cs
- PolicyVersion.cs
- ProfilePropertySettings.cs
- Visual3DCollection.cs
- EmptyStringExpandableObjectConverter.cs
- ParserContext.cs
- FirstMatchCodeGroup.cs
- SqlDataSourceStatusEventArgs.cs
- BamlBinaryReader.cs
- GACMembershipCondition.cs
- TextHidden.cs
- SafeLocalAllocation.cs
- XmlEncoding.cs
- TreeViewBindingsEditor.cs
- ThrowHelper.cs
- MessageParameterAttribute.cs
- NavigatorInput.cs
- COM2ExtendedUITypeEditor.cs
- IsolationInterop.cs
- EventData.cs
- ReturnValue.cs
- IgnoreFileBuildProvider.cs
- StickyNoteHelper.cs
- EntityDataSourceChangingEventArgs.cs
- ObjectPersistData.cs
- XmlSchemaAppInfo.cs
- SystemIPInterfaceStatistics.cs
- Crc32Helper.cs
- FixedPageStructure.cs
- SpoolingTask.cs
- EdmItemCollection.cs
- DetailsViewRow.cs
- XNodeSchemaApplier.cs
- DeviceContext.cs
- Misc.cs
- AnnouncementInnerClientCD1.cs
- HttpValueCollection.cs
- SimpleMailWebEventProvider.cs
- ReflectEventDescriptor.cs
- XmlSchemaExporter.cs
- TimeEnumHelper.cs
- OutputScope.cs
- TryCatchDesigner.xaml.cs
- AutoResizedEvent.cs
- ObjectReferenceStack.cs
- DetailsViewPagerRow.cs
- StringToken.cs
- WorkflowIdleBehavior.cs
- PersonalizableAttribute.cs
- SQLBinary.cs
- SafeFindHandle.cs
- ExternalException.cs
- securitycriticaldataClass.cs
- iisPickupDirectory.cs
- TextServicesLoader.cs
- ProcessModule.cs
- NavigateUrlConverter.cs
- ObjectStateEntryDbDataRecord.cs
- ValidationException.cs
- DataControlPagerLinkButton.cs
- TabletDeviceInfo.cs
- KnownColorTable.cs
- GridViewActionList.cs
- CompositeActivityCodeGenerator.cs
- DefaultAsyncDataDispatcher.cs
- DesignerUtility.cs
- AutomationIdentifier.cs
- WebBrowserDocumentCompletedEventHandler.cs
- ErrorsHelper.cs
- TextTreeTextNode.cs