dtSearch Text Retrieval Engine .NET interface

Server.ConvertPath Method 

Convert between virtual and local paths.

public static string ConvertPath(
   string path,
   int siteId,
   ConvertPathFlags flags,
   string tableLocation
);

Parameters

path
Path to convert, either a virtual or a local path, depending on the flags
siteId
The id of the web site in IIS (the INSTANCE_ID server variable can be used)
flags
Flags indicating the type of conversion to perform
tableLocation
Registry key where the virtual path mappings are stored

Remarks

After a search, the SearchResults object contains a list of the files that were retrieved. These files are expressed as local paths, such as c:\docs\sample.doc. For web-based applications, it is usually preferable to report document locations using virtual directory names, such as /docs/sample.doc. Also, when highlighting hits in PDF files or creating direct links to retrieved documents, a virtual directory name is required.

Internet Information Server stores its mapping between virtual and local paths in the Metabase. Reading this information from the Metabase is time-consuming and requires access rights that may not be available to a process running in the web server context. Therefore, the dtSearch Engine caches this information in the registry, under the key HKEY_LOCAL_MACHINE\Software\dtSearch Corp.\dtSearch\Virtual Roots. By default, ConvertPath will use the cached table values. Call ConvertPath with the dtsCpRefreshMappings + dtsCpStoreInRegistry flags to update the cached information. (Running dtWebSetup.exe, the dtSearch Web Setup program, will also update this information.)

If ConvertPath returns a blank string, it means that either (1) the folder passed in does not have a virtual directory associated with it, or (2) the registry tables have not been refreshed since the virtual directory was created.

See Also

Server Class | dtSearch.Engine Namespace