Problem after creating a query / projection and deleting

Mar 5, 2013 at 2:15 AM

I got the following error when trying to delete a message from the shoutbox :
The required anti-forgery form field "__RequestVerificationToken" is not present.

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.Web.Mvc.HttpAntiForgeryException: The required anti-forgery form field "__RequestVerificationToken" is not present.
Any ideas what I have done wrong?
Mar 5, 2013 at 10:50 AM
Which Orchard version are you using? Does this happen after you restart the site (AppPool recycle or restarting the dev server)? I can't reproduce it.
Mar 5, 2013 at 12:10 PM

I didn't try to restart the app pool or the site after making these changes no, I just did, but the problem still happens. I am using Orchard V 1.6. Here is the stacktrace
Stack Trace: 

[HttpAntiForgeryException (0x80004005): The required anti-forgery form field "__RequestVerificationToken" is not present.]
   System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken) +378334
   System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext) +163
   Orchard.Mvc.AntiForgery.AntiForgeryAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\AntiForgery\AntiForgeryAuthorizationFilter.cs:38
   System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) +156
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854224
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:162
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Looking at this, I'm missing the anti-forgery form field. Please keep in mind I am new to Orchard and ASP.NET coming from a PHP / Drupal world. It is very possible I missed a step, hopefully you can help me fill in the gap.

Mar 5, 2013 at 4:06 PM
OK, I found the issue, the token is indeed missing but if there's another form on the same page then its token will be used. I'll come up with a fix.
Mar 5, 2013 at 6:05 PM
Thanks, I appreciate your effort, nice job on the shoutbox btw.
Mar 5, 2013 at 8:19 PM
I added a fix, would you try it out?
Mar 6, 2013 at 1:00 PM
Edited Apr 3, 2013 at 6:08 PM
Hi, I assumed that you already updated the package in the gallery but I suppose you are proposing to send me the package directly for me to test it out before you update in the gallery. Yes, no problem, please send me the binaries and will test it out.
Mar 6, 2013 at 1:39 PM
I mean please remove everything from the folder of the module in your Orchard instance, download the latest source from under Source here and put it in the folder to try it out.
Mar 6, 2013 at 2:57 PM
Edited Apr 3, 2013 at 6:08 PM
It wont be as easy as I thought.. Somehow, after renaming the folder where the module was, recreating and folder name and extracting the files, and trying to load the site, I got this : ----- Server Error in '/XuG-Orchard' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /XuG-Orchard Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033 ----- To make sure it wasn’t my IIS configuration that was somehow altered, I created myself another site with a clean extract of Orchard 1.6 and the site loads fine. Given my lack of knowledge with Orchard, I am unsure how to resolve this dependency issue.. Any thoughts
Mar 6, 2013 at 2:59 PM
Edited Apr 3, 2013 at 6:08 PM
Disregard previous email, I found the problem.. Leaving a renamed folder under modules doesn’t seem to work well with Orchard and was the reason I got the previous error.. I will try to extract your new code and see what happens.. cheers
Mar 6, 2013 at 3:06 PM
Edited Apr 3, 2013 at 6:09 PM
The issue seems to be resolved but stumbled upon another problem.. This probably has nothing to do with how your module is coded but wanted to check with you and see what your thoughts are.. The place where I can see my messages is defined here : http://localhost:9080/XuG-Orchard/shoutboxmsgs When I click to remove one of the messages, the page is not reloaded here “http://localhost:9080/XuG-Orchard/shoutboxmsgs” but goes here “http://localhost:9080/XuG-Orchard/Admin/Contents/List” which is not what I would expect. Any idea why this is happening? While I’m at it, I would like to know if there is another way, when I edit, to have shoutbox not bring me here : http://localhost:9080/XuG-Orchard/Admin/Contents/Edit/31?ReturnUrl=%2FXuG-Orchard%2Fshoutboxmsgs on a separate page to edit the message but just have an edit box appear right where the text is that we want to change? Regards out.
Mar 6, 2013 at 3:30 PM
Both are by design as this was the most simple solution. This feature being very rarely used we haven't made efforts to make it different.
Mar 6, 2013 at 5:44 PM
When can we expect a new official release with the bug fix in the orchard's gallery?

Thanks again for your support and help!
Mar 6, 2013 at 5:58 PM
We really don't have time to create a release soon. But I strongly encourage you to use this module as a subrepo in your solution (the recent "Ways of source controlling an Orchard solution" blogpost might help you there) so you don't need a Gallery release.
Mar 7, 2013 at 2:12 PM
Edited Apr 3, 2013 at 6:09 PM
Hi again, thanks for your answer. I understand. Perhaps I can be of help in releasing it for you? Is the process complicated? I am trying to get a feel of how things are done and perhaps I can help change that. I have been involved in the DRUPAL community before trying Orchard. I do think Orchard is a very nice platform. There is a need to make some things better and surely this will be done over time by the community on their free time... So yes I do understand when you say you do not have time, and that is why I am trying to see if this is something I could help you guys out with. I understand there is an alternative but this might be a little complicated for some people who are just in charge of maintaining a web site. Regards.
Mar 14, 2013 at 9:56 AM

thank you for your kind offer.

This is how our release process works (what is similar to the Orchard release workflow):
  1. Once the code is done and ready to be release tag it in Mercurial with the vesion number (e.g. 1.5).
  2. Create a new release on the Codeplex page and tie it the changeset that was tagged in the previous step. The release should have release notes.
  3. Include the release notes in the version history under the documentation.
  4. Create the nupkg package for the module and verify it.
  5. Upload the nupkg to the Orchard Gallery and don't forget to copy over every textual data from the previous release (since when a new release is uploaded its initial textual content like description comes from the packages Module.txt).
I'd advise you to take a look at how Mercurial works if you don't know already and how you can employ it to version control your Orchard instance. It makes managing an Orchard website much easier and also helps updates (modules and Orchard itself) a lot better.
Mar 14, 2013 at 5:13 PM
Edited Apr 3, 2013 at 6:09 PM
Hi, Thanks for your feedback. I’ll definitely have to familiarize myself with Mercurial first as I have never used a distributed version control system before. The way you have explained it seems pretty straight forward but will have to get my hands dirty with Mercurial before I can proceed. Thanks again for your help!
Mar 14, 2013 at 5:53 PM
No problem, have fun!