wwProcess::ResolveUrl

This method resolves a Url that starts with a generic ~/ prefix and replaces this with the base virtual path of the application.

This method is used extensively by the Web Control Page framework to allow placing images on forms and having them rendered without having to rely on specific relative paths. Instead you can use ~/ to have the application base path replaced into the path automatically.

The virtual path is determined through the protected GetBaseUrl() method that is called during Init of the class.

Example

In a Web application where the virtual web root is timetrakker, the following URL:

Process.ResolveUrl("~/admin/ProcessInvoices.ttw")

resolves to:

/timetrakker/admin/ProcessInvoices.ttw

Note that the URL is relative. If you need an absolute URL for embedding into emails or social media links use wwProcess::ResolveServerUrl().

o.ResolveUrl()

Remarks

ResolveUrl relies on the cUrlBasePath property which is used to fix up paths. By default this value is set from the Process specific Configuration object defined in your Mainline PRG file. If you don't have a process level configuration object or the object is not hooked up or doesn't contain a cVirtualPath property the base path will end up blank and result in invalid Urls. To fix either assign cUrlBase in your Process startup code (OnProcessInit or Init or cUrlBasePath assignment) or make sure you create a configuration object and attach it to the server configuration object.


See also:

Class wwProcess | wwProcess::ResolveServerUrl | wwProcess::ResolvePath

© West Wind Technologies, 1996-2018 • Updated: 03/21/16
Comment or report problem with topic