asp.net - Cryptic error message from VirtualPathProvider -


I have several ASCX files scattered in ASP.Net Legacy Project.

& lt;% @ Register src = "~ / cms / header.scx "Tag name =" header "tagprofix =" uc2 "%> Line 11: & lt; Div id = "content" runat = "server" & gt; Class = "widget" & gt; VirtualPathProvider returned a VirtualFile object with the VirtualPath set to the expected '/CMS/Header.ascx' instead of '/MyLib/BootstrapHeader.ascx'.

What could be the cause of this error? My open method is not being called either.

  Public class CMSContentVirtualPathProvider: VirtualPathProvider {Private const string CMSContentPath = "CMS /"; Private contact string CMSControlFolderName = "MyLib /"; Private cast string CMSPageFolderName = "Pages /"; Private cast string CMSMasterPagesFolderName = "master /"; Private constant string CMSPFix = "bootstrap"; Public Static Zero AppInitialize () {HostingEnvironment.RegisterVirtualPathProvider (New CMSContentVirtualPathProvider ()); } Public override virtualfile GetFile (String VirtualPath) {// If we are facing our URL (Isvertal Path (Virtual Peth)) {return base.GetFile (virtualPath); } Var translatedPath = TranslatePath (virtualpath); If (base.FileExists (translated page)) returns the new CMSContentVirualFile (translated page); Return back GetFile (Virtual Peth); } Private Static String TransportPath (string virtualpath) {// We are experiencing a regular URL: // translate the URL depending on the file type and if it has been translated it has changed path = "~ /" + CMSContentPath; Var filename = CMSPFix + VirtualPathUtility.GetFilename (Virtual Path); If (fileName.EndsWith ("ascx", string comparion., Ordinary Ignore Seas)) {translatedPath = VirtualPathUtility.Combine (translated page + CMSControlFolderName, fileName); } And if (fileName.EndsWith ("ASPX", string compiler. Ordinary Ignore case)) {translatedPath = VirtualPathUtility.Combine (translated page + CMSPageFolderName, fileName); } And if (fileName.EndsWith ("Master", String Compression. Ordinal Ignore Case)) {translatedPath = VirtualPathUtility.Combine (translated page + CMSMasterPagesFolderName, fileName); } Translated back path; } Public override bool fileexists (virtual path string) {if (virtual path (true)) is true; Return back.Filexists (virtualpath); } Public Static Bull Essential Path (Virtual Path String) {virtual power. Canton (CMS CONTACT); }} Public class CMSContentVirualFile: VirtualFile {Private string CMSPath = "test test and see if it works ...."; Public CMSContentVirualFile (string virtualpath): base (virtualpath) {CMSPath = VirtualPathUtility.ToAppRelative (virtualPath); } // open Never called public override stream () {ASCIIEncoding encoding = new ASCIIEncoding (); Return new memorystream (encoding .getbits (this .msp), incorrect); }}   

}

For the sake of stumbling perfection:

This is a known bug due to a compilation error in the loaded file. This error has been replaced by a secret message, so in most cases nothing wrong with the virtual path provider.

Reference:

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -