Code:
/ DotNET / DotNET / 8.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
- ImmutableAssemblyCacheEntry.cs
- CapabilitiesUse.cs
- QilGeneratorEnv.cs
- QilBinary.cs
- FolderBrowserDialogDesigner.cs
- CodeCommentStatement.cs
- BitmapCodecInfo.cs
- TextEditorCopyPaste.cs
- GridViewDeleteEventArgs.cs
- AuthenticateEventArgs.cs
- CreateParams.cs
- BasicAsyncResult.cs
- CriticalHandle.cs
- DataServiceQueryProvider.cs
- DecoderFallback.cs
- Misc.cs
- DataGridItemEventArgs.cs
- SiteMapDataSourceView.cs
- CodeVariableDeclarationStatement.cs
- LinkTarget.cs
- ToggleButtonAutomationPeer.cs
- TextProperties.cs
- DataControlButton.cs
- EnumType.cs
- TypeDelegator.cs
- XmlAnyAttributeAttribute.cs
- XmlKeywords.cs
- UniqueSet.cs
- RepeaterCommandEventArgs.cs
- HttpCacheParams.cs
- CookielessHelper.cs
- DrawListViewColumnHeaderEventArgs.cs
- CornerRadius.cs
- XmlEncodedRawTextWriter.cs
- Int16Storage.cs
- RichTextBoxConstants.cs
- RemotingAttributes.cs
- PointConverter.cs
- WebPartHelpVerb.cs
- PageEventArgs.cs
- DesignerSerializationOptionsAttribute.cs
- BasicHttpSecurityElement.cs
- EntityReference.cs
- PropertyNames.cs
- X509SubjectKeyIdentifierClause.cs
- ObjectDataSourceView.cs
- AccessDataSourceDesigner.cs
- ParameterCollectionEditorForm.cs
- ComplexLine.cs
- FrameworkRichTextComposition.cs
- SourceItem.cs
- DateTimePicker.cs
- DurationConverter.cs
- FixedSOMPageElement.cs
- XmlWrappingReader.cs
- TextSpan.cs
- GridPattern.cs
- TreeNodeClickEventArgs.cs
- Highlights.cs
- File.cs
- XmlBinaryReader.cs
- TableParaClient.cs
- OracleBinary.cs
- HttpListenerRequest.cs
- Column.cs
- DesignerAdapterAttribute.cs
- CaseExpr.cs
- DataServiceQueryOfT.cs
- MultiBinding.cs
- Simplifier.cs
- XmlSchemaObjectCollection.cs
- FlowDocument.cs
- _ProxyChain.cs
- Metafile.cs
- COM2EnumConverter.cs
- MouseGesture.cs
- ReferenceEqualityComparer.cs
- PackWebResponse.cs
- PerformanceCounterLib.cs
- DictionaryManager.cs
- ThrowHelper.cs
- Base64Decoder.cs
- DispatchChannelSink.cs
- PropertyMetadata.cs
- path.cs
- M3DUtil.cs
- VectorKeyFrameCollection.cs
- SimpleExpression.cs
- RangeValidator.cs
- DbConnectionPoolGroupProviderInfo.cs
- AttributedMetaModel.cs
- ConnectionsZoneAutoFormat.cs
- AbstractExpressions.cs
- JsonSerializer.cs
- Directory.cs
- ObjectDataSourceMethodEventArgs.cs
- DataGridViewCellConverter.cs
- XmlStringTable.cs
- DataGridViewColumnHeaderCell.cs
- WebPartDeleteVerb.cs