Exception from block when POST is used

Hi! We regularly get this error in the Litium log

A public action method 'Index' was not found on controller 'Litium.Accelerator.Mvc.Controllers.Blocks.HeroTextBgImageBlockController'.

The block is used on the home page and has an Index method for [HttpGet] in the block controller but not for [HttpPost] because we don’t use it. The error seems to happen when POST is used (the suspicion is that this is because a bot is trying to post). Anyone else experienced this and/or has a suggestion of how to avoid this error?

Error details and stack trace:

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 2021-05-05 17:19:00 
Event time (UTC): 2021-05-05 15:19:00 
Event ID: 59c5d005debb4d7cb968158b882398ec 
Event sequence: 21680 
Event occurrence: 2 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/2/ROOT-1-132647012198495967 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: D:\SysWeb\Example-Prod\wwwroot\ 
    Machine name: LIT-EXAMPLEWEB01 
 
Process information: 
    Process ID: 18652 
    Process name: w3wp.exe 
    Account name: LITIUMDRIFT\EXAMPLE-ServiceUser 
 
Exception information: 
    Exception type: HttpException 
    Exception message: Execution of the child request failed. Please examine the InnerException for more information.
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)

A public action method 'Index' was not found on controller 'Litium.Accelerator.Mvc.Controllers.Blocks.HeroTextBgImageBlockController'.
   at System.Web.Mvc.Controller.HandleUnknownAction(String actionName)
   at System.Web.Mvc.Controller.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass5_0.<Wrap>b__0()
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)

 
 
Request information: 
    Request URL: https://www.example.com:443/se/ 
    Request path: /se/ 
    User host address: 109.169.85.38 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: LITIUMDRIFT\EXAMPLE-ServiceUser 
 
Thread information: 
    Thread ID: 30 
    Thread account name: LITIUMDRIFT\EXAMPLE-ServiceUser 
    Is impersonating: False 
    Stack trace:    at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)

Litium version: 7.6.2

It may be that you have any other form on the page (search form) that actual are doing a post to the page. Check IIS log if you can find a referrer page for the request to see if there is a cross-request between pages.

When I’m looking in the IIS logs for all requests from 109.169.85.38 it looks like it is a bot trying a lot of different urls, possibly to find security flaws.

But how is it supposed to work in Litium, when posting to a page where a block is used we will always get this error (I guess), can it be avoided?

If the page need to support POST action you also need to ensure that all child controls that are on that page support POST operation (adding the HttpPost attribute on the action method).

The same is for other http verbs like HEAD and OPTIONS that may be used for cache or cross origin validation.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.