Can not reply a topic in a forum

Dec 5, 2012 at 7:50 PM
Edited Dec 5, 2012 at 7:55 PM

I downloaded source codes, setup database and run in VS 2012 in debug mode. I could create a forum and topic but could not reply it. I found the source code Messages/Edit.cshtml line 38:

@{Html.BeginForm(null, null, this.Model.InReplyOf == null ? null : new{msg=this.Model.InReplyOf.Id}, FormMethod.Post, new{@id="topicReplyForm"});}

In this case <form..> tag rendered as shown below:

<form action="/admin/messages/flagged" id="topicReplyForm" method="post">

Changed it as shown below:

@{Html.BeginForm("Add", "Messages", this.Model.InReplyOf == null ? null : new{msg=this.Model.InReplyOf.Id}, FormMethod.Post, new{@id="topicReplyForm"});}

Then it is rendered as shown below:

<form action="/sample-forum/sample-subject-4/reply" id="topicReplyForm" method="post">

And it worked. I'm very suprised such an application has a critical bug like that or what's my fault?

Coordinator
Dec 5, 2012 at 11:06 PM

Hi!

The simple answer is: dev stack states VS2010 not 2012. We don't give support for the dev environment, just the releases... :)

The long answer: Weird!

Obviously, I can not reproduce this error. Not on my dev machine, nor on sample website, etc.

Using null values for the action and controller names in the BeginForm forces the helper to use the current route values. This is the way to go, because in this way you can reuse the view for adding and editing (it posts the form on the current action).

Are the projects in your solution referencing ASP.NET MVC 3 binaries (or MVC 4)?

Kind Regards,

Jorge