# Exception from block when POST is used

**URL:** <https://forum.litium.com/t/exception-from-block-when-post-is-used/2064>\
**Category:** Questions\
**Created:** [May 19, 2021, 8:59am UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064 "2021-05-19T08:59:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonas.olsson](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/jonas.olsson/32/177_2.png) [@jonas.olsson](https://forum.litium.com/u/jonas.olsson)\
**Post date:** [May 19, 2021, 8:59am UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064/1 "2021-05-19T08:59:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [May 19, 2021, 10:09am UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064/2 "2021-05-19T10:09:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jonas.olsson](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/jonas.olsson/32/177_2.png) [@jonas.olsson](https://forum.litium.com/u/jonas.olsson)\
**Post date:** [May 19, 2021, 3:13pm UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064/3 "2021-05-19T15:13:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [May 19, 2021, 7:22pm UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064/4 "2021-05-19T19:22:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [June 16, 2021, 7:22pm UTC](https://forum.litium.com/t/exception-from-block-when-post-is-used/2064/5 "2021-06-16T19:22:40Z")

</div>

Closed on June 16, 2021, 7:22pm UTC

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