views:

656

answers:

2

Hi I am using ASP.Net 3.5 SP1 and attempting to implement a sample copy of http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx into a sample web application however I seem to be having some issues.

I am running windows vista, IIS 7.0, integrated-mode.

Below is the YSOD:

Cannot create an abstract class.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Cannot create an abstract class.

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: [MissingMethodException: Cannot create an abstract class.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230 System.Activator.CreateInstance(Type type, Boolean nonPublic) +67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111 System.Web.Configuration.HandlerFactoryCache..ctor(String type) +57 System.Web.HttpApplication.GetFactory(String type) +78 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +229 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

I have an interface which looks like so:

public interface IRoutablePage : IHttpHandler
{
    UrlHelper Url { get; }
    HtmlHelper Html { get; }
    RequestContext RequestContext { get; set;}
}

I have an abstract class (RoutablePage) which inherits this interface and System.Web.UI.Page.

I then have a web page (attached to a masterpage) which inherits the RoutablePage class.

I have routes setup in my web config and when I try and access http://local.url/pageName I experience the YSOD with the information above.

Can anyone help solve this issue please?

Cheers

A: 

The problem has been temporarily fixed. Running the website under IIS7 causes the above problem and running the website using cassini, every runs as expected with no errors.

Any further information on this problem would be appreciated however.

+2  A: 

I'm having the same problem. I was able to find an unswear on this forum http://forums.asp.net/t/1272109.aspx

Cross posting what helped me:

In Web.config -> system.webserver -> handlers, replace

  <add name="UrlRoutingHandler"
 preCondition="integratedMode" verb="*"
 path="UrlRouting.axd"
 type="System.Web.Routing.UrlRoutingHandler,
 System.Web.Routing, Version=0.0.0.0,
 Culture=neutral,
 PublicKeyToken=31BF3856AD364E35"/>

With:

  <add name="UrlRoutingHandler"
 preCondition="integratedMode" verb="*"
 path="UrlRouting.axd"
 type="System.Web.HttpForbiddenHandler,
 System.Web, Version=2.0.0.0,
 Culture=neutral,
 PublicKeyToken=b03f5f7f11d50a3a" />
Seems to have worked for me as well. Thanks!
rball