Blog      Products      DotNetWiki      Support      Contact  
     Blog Categories
 - All
 - .NET
 - 4 Word Book Reviews
 - AllPodcasts
 - Business Thoughts
 - Clueless Idiocy
 - Norn Iron
 - Personal
 - Podcasting
 - PowerPack
 - Weird Interweb Stuff
 
     Geoff on Twitter
 
     Local Blogs
 
  ASP.NET PowerPack
The ASP.NET PowerPack contains 28 rich, cross-browser controls including:
 - RichTextBox
 - ComboBox
 - DatePicker
 - No-Repost validator

Try the ASP.NET PowerPack free today!
 - More Info
 - Download
 - Price List
 - Licensing
 - Buy Now!

 
     Web Tools
 - The DotNetWiki
 - OPML Viewer
 - RSS Viewer
 - ASP.NET Colors
 - Base64 Encode
 - Base64 Decode
 - HTML Encode
 - HTML Decode
 - URL Encode
 - URL Decode
 - Crazy IPs
 - Whois

 
     Windows Tools

ADO.NET ConnTest
A simple, free Windows program to test ADO.NET connection strings.

Lines of C#
Ever wanted to know how many lines of C# code are in a file or folder hierarchy?  This free Windows program will tell you.

XmlTools
Free tools to process XML files from the command line.

 
The VirtualPathProvider returned a VirtualFile object with VirtualPath set to '/Page.aspx' instead of the expected '//Page.aspx'.

If you're here because you've just done a Google search for an error like "The VirtualPathProvider returned a VirtualFile object with VirtualPath set to '/Page.aspx' instead of the expected '//Page.aspx'" then I have some good news for you.

The reason you get the error is that your virtual page has a compilation error in it.  It has nothing to do with your VirtualPathProvider, really.

What seems to be happening is that it calls your VirtualPathProvider for your page, gets the appropriate Stream that points to the file's contents, tries to compile the page, fails, and then calls your GetFile () with the same parameter but with an extra '/' at the front.

I have no idea why it does this.

I'm also sad that Google let me down (there was only one hit and it didn't have an answer) and I had to figure this out for myself.  I mean, having to actually think?

And I'm embarrassed at how long it took me to figure out...  Still, hopefully it'll help someone else out.



Categories: .NET
Technorati Tags:   
Permalink #.Posted by 'geoff' on Thursday, 17 May 2007 at 6:26PM


Comments, Trackbacks and Pingbacks

Thanks
Thank you, thank you!
 
How did you figure that out, anyway?

Posted by 'Star' on Friday, 20 June 2008 at 8:11PM


Trial...
Trial and - a lot of - error!

Posted by 'Geoff' on Saturday, 21 June 2008 at 11:09AM


Not quite...
Hi,
 
I'm getting that error when I have a website as a virtual directory within another website.  If I open the original website and go to the page in question through it's own website it all works fine so there is no compilation error.  When I go to the page in question as a virtual directory within another website then I get the above error.
 
Could it be a web.config thing?
 
Cheers,
MH

Posted by 'Biffster007' on Tuesday, 20 January 2009 at 10:34PM


Hard to say
Hi,
 
I think it's really hard to say what the underlying problem is.  My guess (and it's only a guess) is that there's some exception being thrown when it's in a virtual directory.  As you say, it can't be a parse error when it parses OK on another site (unless your references / DLLs in the bin directory are wrong).  I'm not sure what to suggest to dig into it further - are there any other relevant messages in the Event Log?  Can you attach a debugger and break on exceptions?
 
Good luck,
 
    Geoff

Posted by 'Geoff Taylor' on Wednesday, 21 January 2009 at 12:01PM

Post A Comment

Your Name:
Your URL (optional):
Comment Title:


View my Technorati Profile.
RSS 2.0 Subscribe to the RSS 2.0 feed for Geoff's Blog.