开发者

Adding a stand alone ASPX page to an existing web application (.Net 3.5)

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 some开发者_C百科thing that I can do to pre-compile just this one page. (Note: It doesn't reference any external controls, Masterpages, etc.)


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜