1

Closed

PrecompiledMvcEngine baseVirtualPath causing exception

description

I have supplied a baseVirtualPath value of "Areas/Reporting" which throws the error:

The relative virtual path '~Views/home/Index.cshtml' is not allowed here.

I have traced it to IsPhysicalFileNewer Method:
 private bool IsPhysicalFileNewer(string virtualPath)
        {
            if (virtualPath.StartsWith(_baseVirtualPath ?? String.Empty, StringComparison.OrdinalIgnoreCase))
            {
                // If a base virtual path is specified, we should remove it as a prefix. Everything that follows should map to a view file on disk.
                if (!String.IsNullOrEmpty(_baseVirtualPath))
                {
                    virtualPath = "~" + virtualPath.Substring(_baseVirtualPath.Length);
                }
Attaching a "/" to the tilde creates a correct virtual path.
 virtualPath = "~/" + virtualPath.Substring(_baseVirtualPath.Length);
Can this be verified?
Closed Aug 22, 2013 at 6:27 PM by davidebbo
Fixed in v2.1.2. Can you please verify? Thanks!

comments