Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / System.ServiceModel.Activation / System / ServiceModel / Activation / ServiceRoute.cs / 1305376 / ServiceRoute.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System; using System.Globalization; using System.Web.Routing; public class ServiceRoute : Route { internal const string LeftCurlyBracket = "{"; internal const string RightCurlyBracket = "}"; internal const string UnmatchedPathSegment = "{*pathInfo}"; internal const char PathSeperator = '/'; public ServiceRoute(string routePrefix, ServiceHostFactoryBase serviceHostFactory, Type serviceType) : base(CheckAndCreateRouteString(routePrefix), new ServiceRouteHandler(routePrefix, serviceHostFactory, serviceType)) { if (TD.AspNetRouteIsEnabled()) { TD.AspNetRoute(routePrefix, serviceType.AssemblyQualifiedName, serviceHostFactory.GetType().AssemblyQualifiedName); } } static string CheckAndCreateRouteString(string routePrefix) { // aspnet routing integration is supported only under aspnet compat mode ServiceHostingEnvironment.EnsureInitialized(); if (!ServiceHostingEnvironment.AspNetCompatibilityEnabled) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.Hosting_RouteServiceRequiresCompatibilityMode)); } // we support emptystring as routeprfix as aspnet allows it if (routePrefix == null) { throw FxTrace.Exception.ArgumentNull("routePrefix"); } else if (routePrefix.Contains(LeftCurlyBracket) || routePrefix.Contains(RightCurlyBracket)) { throw FxTrace.Exception.Argument("routePrefix", SR.Hosting_CurlyBracketFoundInRoutePrefix("{", "}")); } if(routePrefix.EndsWith(PathSeperator.ToString(), StringComparison.CurrentCultureIgnoreCase) || routePrefix.Equals(String.Empty, StringComparison.CurrentCultureIgnoreCase)) { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}{1}", routePrefix, UnmatchedPathSegment); } else { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}/{1}", routePrefix, UnmatchedPathSegment); } return routePrefix; } } } // 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
- SiteMapProvider.cs
- CallbackValidator.cs
- ClassHandlersStore.cs
- EventDriven.cs
- SendSecurityHeader.cs
- TimeEnumHelper.cs
- DataGridColumn.cs
- ToggleButtonAutomationPeer.cs
- LinearGradientBrush.cs
- CssTextWriter.cs
- View.cs
- UdpSocketReceiveManager.cs
- Int64Converter.cs
- ParameterCollection.cs
- Tool.cs
- Int16.cs
- SchemaImporterExtension.cs
- XslCompiledTransform.cs
- MenuTracker.cs
- HMAC.cs
- Brush.cs
- wmiprovider.cs
- ApplicationContext.cs
- UnsafeNativeMethods.cs
- DataTransferEventArgs.cs
- UnsafeNativeMethods.cs
- FormView.cs
- UpdatePanelTrigger.cs
- Setter.cs
- Membership.cs
- FileSystemInfo.cs
- ListControlConvertEventArgs.cs
- DiscoveryDocumentReference.cs
- Latin1Encoding.cs
- SelectQueryOperator.cs
- KeySplineConverter.cs
- ItemChangedEventArgs.cs
- FontCollection.cs
- RegionInfo.cs
- DmlSqlGenerator.cs
- XmlSerializationGeneratedCode.cs
- ConfigViewGenerator.cs
- EasingKeyFrames.cs
- EntityConnectionStringBuilder.cs
- ExpressionPrefixAttribute.cs
- RemotingException.cs
- OledbConnectionStringbuilder.cs
- BidOverLoads.cs
- TypeBrowser.xaml.cs
- QueryModel.cs
- XmlBaseWriter.cs
- FixedDocumentPaginator.cs
- ChtmlTextWriter.cs
- PenCursorManager.cs
- SqlUserDefinedTypeAttribute.cs
- RelatedImageListAttribute.cs
- EntitySetBaseCollection.cs
- ToolStripPanelCell.cs
- AlignmentYValidation.cs
- QueryExecutionOption.cs
- Encoder.cs
- NamespaceQuery.cs
- HtmlContainerControl.cs
- RegexNode.cs
- ConsoleKeyInfo.cs
- DocumentViewerConstants.cs
- securitymgrsite.cs
- Descriptor.cs
- TraceHandler.cs
- PropertyDescriptorGridEntry.cs
- PeerApplication.cs
- SynchronizationContext.cs
- CodeComment.cs
- TableItemPattern.cs
- IIS7WorkerRequest.cs
- MediaCommands.cs
- BufferModeSettings.cs
- DataGridTextBoxColumn.cs
- OracleCommandSet.cs
- DataGridViewCellStyleBuilderDialog.cs
- TextComposition.cs
- HttpListenerResponse.cs
- NativeMethods.cs
- Int16AnimationBase.cs
- ReadOnlyAttribute.cs
- Thickness.cs
- DispatcherProcessingDisabled.cs
- Function.cs
- CommandConverter.cs
- BaseCollection.cs
- DbUpdateCommandTree.cs
- DataFormats.cs
- StringBuilder.cs
- SizeChangedInfo.cs
- DesignerVerbCollection.cs
- UnsafeNativeMethods.cs
- ResourceDescriptionAttribute.cs
- MenuItemStyleCollection.cs
- CompModSwitches.cs
- ContextStaticAttribute.cs