Developer forum

Forum » Development » Method AuthenticateRequestArgs.get_Application() not found with DW 9.9.6

Method AuthenticateRequestArgs.get_Application() not found with DW 9.9.6

Jose Caudevilla
Reply

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.


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Jose,

Perhaps you're running into the same type of issue as discussed in this thread?
https://doc.dynamicweb.com/forum/dynamicweb-9-0-upgrade-issues/dynamicweb-9-0-upgrade-issues/application-authenticaterequestargs-have-changed

- Jeppe

Votes for this answer: 1
 
Jose Caudevilla
Reply

Hi Jeppe,

Thanks. I didnĀ“t found that post.

Now all works perfect, the HandleRouteNotification code is now the following:

[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(System.Web.HttpContext.Current));
		if (routeData != null && routeData.RouteHandler.ToString() != "Dynamicweb.Frontend.DynamicwebRouteHandler")
		{
			//throw new System.Exception(routeData.RouteHandler.ToString());
			myargs.Handled = true;
		}
	}

	public override int Rank
	{
		get { return base.Rank - 70; }
	}
}

 

Regard,

Jose

 

 

You must be logged in to post in the forum