This project is read-only.

ASP.NET Server Controls in a Module?

Topics: Writing modules
Jun 7, 2011 at 7:54 PM
Edited Jun 7, 2011 at 7:56 PM

I’m trying to get an ASP.NET custom Server Control working inside an Orchard Module but the browser gives this error:

The WebResource.axd handler must be registered in the configuration to process this request.

The Module is based off the HelloWorld sample Module and references a few helper dlls, with the appropriate Web.config additions to system.webServer.modules, system.web.pages.controls and system.web.httpHandlers for WebResource.axd. The additions have been added to both the web.config in the Orchard.Web root and the Module project’s root. The view page is an aspx page and not a razor cshtml page.

Does anyone have an idea why it is giving this error?

Jun 7, 2011 at 8:02 PM

Orchard is built on ASP.NET MVC. That control you are using is WebForms, not ASP.NET MVC.

Jun 8, 2011 at 7:21 PM

The problem was resolved by adding to the Web.config system.webServer.handlers before the HttpNotFoundHandler:
<add name="AXD" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader">

Jun 8, 2011 at 7:33 PM

This will only make it work superficially. Most WebControls rely on a complex postback infrastructure that is simply not available from MVC applications such as Orchard. I highly recommend you look for alternatives to that control. Which control is it by the way?

Jun 8, 2011 at 7:46 PM

You are right, there are no alternative controls in this case. 

I am trying to get Intellifactory's WebSharper to run inside a Module, it requires two server tags, one for script management and another for the control(

The script management tag is working but not the control tag, I believe it may have something to do with the httpModule requirement which I am now following this forum post for a solution: