Hello:
I had a web page that use a custom WebApi by following the next post:
https://doc.dynamicweb.com/forum/dynamicweb-9-0-upgrade-issues/dynamicweb-9-0-upgrade-issues/using-webapi-with-attribute-routing-in-dw-9
Before update DW to 9.9.6 all works perfect, but when i updated it i get the following error:
[MissingMethodException: Method not found: 'System.Web.HttpApplication AuthenticateRequestArgs.get_Application()'.] MyArea.WebApi.WebApiEnabler.OnNotify(String notification, NotificationArgs args) in C:\VS\XXXX\HandleRouteNotification.cs:26 Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs) +866 Dynamicweb.Admin.GlobalAsaxHandlerProxy.Application_AuthenticateRequest(Object sender, EventArgs e) +406 Dynamicweb.Admin.Global.Application_AuthenticateRequest(Object sender, EventArgs e) +64 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +139 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +88
This is my HandleRouteNotification code:
[Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Standard.Application.AuthenticateRequest)] public class HandleRouteNotification : Dynamicweb.Extensibility.Notifications.NotificationSubscriber { public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args) { Dynamicweb.Notifications.Standard.Application.AuthenticateRequestArgs myargs = (Dynamicweb.Notifications.Standard.Application.AuthenticateRequestArgs)args;
System.Web.Routing.RouteData routeData = System.Web.Routing.RouteTable.Routes.GetRouteData(new System.Web.HttpContextWrapper(myargs.Application.Context)); if (routeData != null && routeData.RouteHandler.ToString() != "Dynamicweb.Frontend.DynamicwebRouteHandler") { myargs.Handled = true; } } public override int Rank { get { return base.Rank - 70; } } }
The line in witch the error ocurrs is the following:
System.Web.Routing.RouteData routeData = System.Web.Routing.RouteTable.Routes.GetRouteData(new System.Web.HttpContextWrapper(myargs.Application.Context));
Is there any way to create the route handler ? Or this is just a bug of the dw 9.9.6 version?
Thanks,
Jose.