Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Hosting / SimpleApplicationHost.cs / 3 / SimpleApplicationHost.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Hosting { using System; using System.Collections; using System.Configuration; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security.Permissions; using System.Web; using System.Web.Configuration; using System.Web.UI; using System.Web.Util; using Microsoft.Win32; using Debug = System.Web.Util.Debug; internal class SimpleApplicationHost : MarshalByRefObject, IApplicationHost { private VirtualPath _appVirtualPath; private String _appPhysicalPath; internal SimpleApplicationHost(VirtualPath virtualPath, string physicalPath) { if (String.IsNullOrEmpty(physicalPath)) throw ExceptionUtil.ParameterNullOrEmpty("physicalPath"); // Throw if the physical path is not canonical, to prevent potential // security issues ( if (FileUtil.IsSuspiciousPhysicalPath(physicalPath)) { throw ExceptionUtil.ParameterInvalid(physicalPath); } _appVirtualPath = virtualPath; _appPhysicalPath = StringUtil.StringEndsWith(physicalPath, "\\") ? physicalPath : physicalPath + "\\"; } public override Object InitializeLifetimeService() { return null; // never expire lease } // IApplicationHost implementation public string GetVirtualPath() { return _appVirtualPath.VirtualPathString; } String IApplicationHost.GetPhysicalPath() { return _appPhysicalPath; } IConfigMapPathFactory IApplicationHost.GetConfigMapPathFactory() { return new SimpleConfigMapPathFactory(); } IntPtr IApplicationHost.GetConfigToken() { return IntPtr.Zero; } String IApplicationHost.GetSiteName() { return WebConfigurationHost.DefaultSiteName; } String IApplicationHost.GetSiteID() { return WebConfigurationHost.DefaultSiteID; } public void MessageReceived() { // nothing } } [Serializable()] internal class SimpleConfigMapPathFactory : IConfigMapPathFactory { IConfigMapPath IConfigMapPathFactory.Create(string virtualPath, string physicalPath) { WebConfigurationFileMap webFileMap = new WebConfigurationFileMap(); VirtualPath vpath = VirtualPath.Create(virtualPath); // Application path webFileMap.VirtualDirectories.Add(vpath.VirtualPathStringNoTrailingSlash, new VirtualDirectoryMapping(physicalPath, true)); // Client script file path webFileMap.VirtualDirectories.Add( HttpRuntime.AspClientScriptVirtualPath, new VirtualDirectoryMapping(HttpRuntime.AspClientScriptPhysicalPathInternal, false)); return new UserMapPath(webFileMap); } } } // 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
- WindowsBrush.cs
- SchemaMapping.cs
- XmlLanguage.cs
- WebPartsPersonalization.cs
- HyperLinkField.cs
- TagNameToTypeMapper.cs
- ICspAsymmetricAlgorithm.cs
- DateTimeConverter2.cs
- DependencyObject.cs
- SocketManager.cs
- EmptyElement.cs
- TransportContext.cs
- ApplicationServiceManager.cs
- ManagementEventWatcher.cs
- PlatformCulture.cs
- ServiceOperationInfoTypeConverter.cs
- WhitespaceRule.cs
- wmiutil.cs
- TextCharacters.cs
- HandleRef.cs
- NamedPermissionSet.cs
- clipboard.cs
- FormViewPageEventArgs.cs
- webbrowsersite.cs
- FlowPosition.cs
- util.cs
- SmiContextFactory.cs
- MappingModelBuildProvider.cs
- SelectionListDesigner.cs
- DataGridHyperlinkColumn.cs
- Material.cs
- TextServicesManager.cs
- DefaultAuthorizationContext.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CharacterMetricsDictionary.cs
- Connection.cs
- RegexWriter.cs
- PathGeometry.cs
- XPathParser.cs
- MaterializeFromAtom.cs
- XmlNodeWriter.cs
- BaseInfoTable.cs
- ToolboxDataAttribute.cs
- QueryStringParameter.cs
- ImageDrawing.cs
- XmlCharCheckingWriter.cs
- ExpressionPrinter.cs
- DataFormats.cs
- MenuCommands.cs
- ProxyWebPartConnectionCollection.cs
- SetState.cs
- ArrayTypeMismatchException.cs
- CommandManager.cs
- SettingsSavedEventArgs.cs
- ColumnPropertiesGroup.cs
- WebConfigurationHost.cs
- DataSetMappper.cs
- CompositeFontFamily.cs
- ThreadStateException.cs
- KeyedCollection.cs
- InternalPermissions.cs
- SystemIPGlobalProperties.cs
- DaylightTime.cs
- WindowsEditBoxRange.cs
- ExceptionUtil.cs
- Int32EqualityComparer.cs
- ConnectionManagementElement.cs
- QuaternionRotation3D.cs
- SQLInt32Storage.cs
- AnnotationService.cs
- SqlXml.cs
- Trigger.cs
- FormViewModeEventArgs.cs
- Axis.cs
- LiteralControl.cs
- ProcessMonitor.cs
- EventSinkHelperWriter.cs
- OletxDependentTransaction.cs
- SubclassTypeValidatorAttribute.cs
- MimeXmlReflector.cs
- UserControlAutomationPeer.cs
- FastEncoderWindow.cs
- BamlVersionHeader.cs
- SchemeSettingElementCollection.cs
- AbstractSvcMapFileLoader.cs
- ChildDocumentBlock.cs
- XLinq.cs
- CheckBoxAutomationPeer.cs
- EncodedStreamFactory.cs
- StringUtil.cs
- TextContainer.cs
- ConstantCheck.cs
- ClockGroup.cs
- DivideByZeroException.cs
- DynamicRenderer.cs
- NullableFloatSumAggregationOperator.cs
- Stack.cs
- DbModificationClause.cs
- DataContractJsonSerializer.cs
- LinkedResource.cs