2

I downloaded the file discussed in this article and tried "dropping it into" a production web site, but got the following error when I tried to access it through my Web browser:

[HttpException (0x80004005): The file '/WebResources.aspx' has not been pre-compiled, and cannot be requested.]

If I drop the file into webs on my local machine, it runs fine. How do I pre-compile this single file without re-publishing the whole application? Is there something that I can do to pre-compile just this one page. (Note: It doesn't reference any external controls, Masterpages, etc.)

AhsenBaig
  • 497
  • 4
  • 21
Sean
  • 21
  • 1
  • 2

2 Answers2

0

One lazy solution for your problem (without checking the source of the error) is to view the page inside an iFrame.

<iframe src="/WebResource.aspx" width="100%" height="100%">Your browser does not support iFrame</iframe>

but if you need that page to interact with controls outside of its scope, then you will need to look into the header part of the ASPX and make sure that it inherits from the proper class, and is part of the Web Project that is calling the page.

Ahmad
  • 12,336
  • 6
  • 48
  • 88
  • I believe that all this will do is display the same error ("The file '/WebResources.aspx' has not been pre-compiled, and cannot be requested") in an iframe. – Sean Jun 20 '11 at 22:09
  • if the page can be viewed from a different host virtual folder (as you have indicated), or another web application, then you can still use iframe to view it using the full url of the remote project – Ahmad Jun 20 '11 at 22:13
0

This is pretty easy to do.

  1. Put the file into it's own web application project.
  2. Publish the project to a local directory.
  3. Copy the file and associated assembly to your existing web application. Take care NOT to overwrite your web.config.

Done. This new file now has access to everything your other web app does.

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • Wow! Seriously?! For some reason I thought it would be something more complicated than this. I'll give it a try! Thanks, Chris! – Sean Jun 20 '11 at 22:17
  • One of our projects is actually made up of several web applications that are deployed into the exact same location. It's an interesting way to support "modularity" in web applications. The only caveat is that you cannot have files of the same name. – NotMe Jun 21 '11 at 02:46
  • Well, I'm sorry to say that this solution didn't solve the issue. I created a new web application project in VS and added the single page (WebResources.aspx), then published to a local directory. Four files were published: WebResources.aspx, Web.Config, bin\WebResources.dll, and bin\WebResources.pdb. I then copied the files, except for the web.config, to their corresponding locations in the production web (root and bin, respectively), but the error still persists. – Sean Jun 21 '11 at 16:27
  • Sounds like you are missing at least one assembly on your web server. Interesting: http://forums.asp.net/t/956297.aspx – NotMe Jun 21 '11 at 16:57
  • @Sean G: Another idea is whether you have asp.net 3.5 installed on your server or not. – NotMe Jun 21 '11 at 16:59
  • Yes, we have 3.5 installed and both apps (the production app and my WebResources app) were both compile 3.5. – Sean Jun 21 '11 at 20:17