Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Hosting / SimpleApplicationHost.cs / 2 / 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 (VSWhidbey 418125) 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Pen.cs
- ArraySubsetEnumerator.cs
- DBBindings.cs
- PropertySourceInfo.cs
- DataServiceRequestArgs.cs
- TextEditorCopyPaste.cs
- LinkUtilities.cs
- CacheDependency.cs
- _LazyAsyncResult.cs
- Dispatcher.cs
- RtfToXamlLexer.cs
- DataColumnMappingCollection.cs
- BufferedReadStream.cs
- PictureBox.cs
- SafeLocalMemHandle.cs
- MetaForeignKeyColumn.cs
- SelectionItemProviderWrapper.cs
- CollectionViewGroup.cs
- LocalizationParserHooks.cs
- FixedPageAutomationPeer.cs
- ConfigurationManagerHelperFactory.cs
- ApplicationActivator.cs
- FixUp.cs
- DisposableCollectionWrapper.cs
- LassoSelectionBehavior.cs
- WebBaseEventKeyComparer.cs
- ResourceKey.cs
- PriorityBindingExpression.cs
- MimeMapping.cs
- SetStoryboardSpeedRatio.cs
- BatchWriter.cs
- AncestorChangedEventArgs.cs
- PriorityRange.cs
- CardSpacePolicyElement.cs
- TabControlCancelEvent.cs
- BindingFormattingDialog.cs
- SeverityFilter.cs
- FontStretchConverter.cs
- TreeBuilder.cs
- IisTraceWebEventProvider.cs
- LineServicesCallbacks.cs
- SerTrace.cs
- ObjectListGeneralPage.cs
- MediaTimeline.cs
- _RegBlobWebProxyDataBuilder.cs
- HuffmanTree.cs
- SpeechDetectedEventArgs.cs
- RequestCachePolicy.cs
- PathTooLongException.cs
- SmiSettersStream.cs
- CompileLiteralTextParser.cs
- HttpFileCollection.cs
- WmlImageAdapter.cs
- RSAPKCS1KeyExchangeFormatter.cs
- DataGridViewCellValidatingEventArgs.cs
- ProgressBarBrushConverter.cs
- NativeMethods.cs
- Win32Native.cs
- TrackingMemoryStreamFactory.cs
- DataRecordInfo.cs
- ResXResourceSet.cs
- DataSourceCollectionBase.cs
- DesignerDataColumn.cs
- HotCommands.cs
- GroupItem.cs
- WorkflowDefinitionContext.cs
- FolderBrowserDialog.cs
- DataGridViewCellStyleEditor.cs
- DataPagerCommandEventArgs.cs
- XPathSelfQuery.cs
- UnmanagedHandle.cs
- TreeNode.cs
- HttpCachePolicy.cs
- StreamUpgradeBindingElement.cs
- QilGenerator.cs
- CryptoProvider.cs
- OptimisticConcurrencyException.cs
- ExtensionWindowHeader.cs
- DocumentXmlWriter.cs
- ToolboxItemAttribute.cs
- ConfigurationValues.cs
- RegisteredScript.cs
- baseaxisquery.cs
- PropertyBuilder.cs
- ResourceWriter.cs
- Pointer.cs
- ParagraphResult.cs
- SamlSecurityTokenAuthenticator.cs
- AttributeTable.cs
- EnlistmentState.cs
- TextRange.cs
- assemblycache.cs
- AddingNewEventArgs.cs
- StylusLogic.cs
- BindingManagerDataErrorEventArgs.cs
- RC2.cs
- RightsManagementInformation.cs
- XmlSchemaChoice.cs
- PartialList.cs
- UnknownBitmapDecoder.cs