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
- ADConnectionHelper.cs
- CodeSubDirectory.cs
- InstalledFontCollection.cs
- PerformanceCounters.cs
- ObjectSpanRewriter.cs
- CachedPathData.cs
- ButtonBaseAdapter.cs
- ConnectionDemuxer.cs
- TypedElement.cs
- CodeExpressionStatement.cs
- ExpressionEditor.cs
- Clock.cs
- SelectManyQueryOperator.cs
- MatrixCamera.cs
- Highlights.cs
- SponsorHelper.cs
- ButtonFieldBase.cs
- StrokeCollection2.cs
- SystemColors.cs
- RelationshipSet.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- CompilationSection.cs
- PrintPreviewControl.cs
- KeyEvent.cs
- MaskedTextBoxDesigner.cs
- ApplicationActivator.cs
- StringValidator.cs
- Decorator.cs
- EnumValAlphaComparer.cs
- CodeDOMProvider.cs
- ContainerVisual.cs
- SqlUnionizer.cs
- CodeCatchClause.cs
- ToolboxItem.cs
- FlowNode.cs
- TablePatternIdentifiers.cs
- WeakHashtable.cs
- BezierSegment.cs
- XPathNodeInfoAtom.cs
- OutputCacheEntry.cs
- DesignerLoader.cs
- FigureParagraph.cs
- dataprotectionpermission.cs
- SymmetricKeyWrap.cs
- DataGridViewBindingCompleteEventArgs.cs
- XPathNodeInfoAtom.cs
- DeleteMemberBinder.cs
- CodeCompiler.cs
- coordinatorfactory.cs
- ComplexType.cs
- SchemaCompiler.cs
- XPathNodeList.cs
- XsdValidatingReader.cs
- XmlElementAttribute.cs
- SQlBooleanStorage.cs
- LocalizableResourceBuilder.cs
- SelectionEditingBehavior.cs
- SafeThemeHandle.cs
- TrackingAnnotationCollection.cs
- CodeNamespaceImport.cs
- X509Utils.cs
- MetadataFile.cs
- TimeSpanSecondsConverter.cs
- ExceptionHelpers.cs
- Substitution.cs
- NameNode.cs
- UnaryNode.cs
- ExclusiveTcpTransportManager.cs
- x509store.cs
- Point.cs
- OdbcCommand.cs
- XamlPathDataSerializer.cs
- HotSpot.cs
- TemplateXamlTreeBuilder.cs
- FreezableOperations.cs
- RadialGradientBrush.cs
- AssemblyGen.cs
- ThicknessAnimation.cs
- ExclusiveCanonicalizationTransform.cs
- Header.cs
- WebBrowserProgressChangedEventHandler.cs
- GetRecipientListRequest.cs
- PackagePartCollection.cs
- TextPointer.cs
- TraceListener.cs
- ExpressionBuilderCollection.cs
- mediaclock.cs
- SystemInfo.cs
- StrokeNodeOperations.cs
- PtsContext.cs
- StorageFunctionMapping.cs
- ComponentRenameEvent.cs
- RuntimeEnvironment.cs
- SafeProcessHandle.cs
- StreamUpdate.cs
- ReadOnlyHierarchicalDataSourceView.cs
- DataKeyCollection.cs
- Comparer.cs
- DataGridViewBindingCompleteEventArgs.cs
- ObjectCacheSettings.cs