internal static object AddVirtualPathToFileMapping(VirtualPath virtualPath, string physicalPath) { CallContext.SetData(GetFixedMappingSlotName(virtualPath), physicalPath); VirtualPathToFileMappingState state = new VirtualPathToFileMappingState { VirtualPath = virtualPath, VirtualPathProvider = _theHostingEnvironment._virtualPathProvider }; _theHostingEnvironment._virtualPathProvider = _theHostingEnvironment._mapPathBasedVirtualPathProvider; return state; }
/* * Map a virtual path to a physical path. i.e. the physicalPath will be returned * when MapPath is called on the virtual path, bypassing the IApplicationHost */ internal static object AddVirtualPathToFileMapping( VirtualPath virtualPath, string physicalPath) { // Save the mapping in the call context, using a key derived from the // virtual path. The mapping is only valid for the duration of the request. CallContext.SetData(GetFixedMappingSlotName(virtualPath), physicalPath); // Return a mapping object to keep track of the virtual path, and of the current // virtualPathProvider. VirtualPathToFileMappingState state = new VirtualPathToFileMappingState(); state.VirtualPath = virtualPath; state.VirtualPathProvider = _theHostingEnvironment._virtualPathProvider; // Always use the MapPathBasedVirtualPathProvider, otherwise the mapping mechanism // doesn't work (VSWhidbey 420702) // Set/Get the VPP on the call context so as not to affect other concurrent requests (Dev10 852255) CallContext.SetData(TemporaryVirtualPathProviderKey, _theHostingEnvironment._mapPathBasedVirtualPathProvider); return state; }