Take the 2-minute tour ×

My view:


<viewdata model="EditUserNameViewData" />
<form action="~/User/EditUserName" method="post" class="span-15 last">
<Submit id='"chooseNewName"' value='"Choose new name"' />

Controller actions:

[AcceptVerbs(HttpVerbs.Get)] public ActionResult EditUserName(int id) { EditUserNameViewData vd = new EditUserNameViewData(); vd.ExistingName = _userRepository.Get(id).UserName; return View("EditUserName", vd); }

[AcceptVerbs(HttpVerbs.Post)] public ActionResult EditUserName(string newUserName) { try { // fails } catch(RulesException errors) { errors.AddModelStateErrors(ModelState, string.Empty); return View(); } }

the return View() does not seem to work as it redirects to


and gives me a 404 error. WTF? I'm using xVal for validation and everything on that end works just can't get it to redisplay the prior page with the information the user put in displayed in the box. Anyone know what I'm doing wrong? This is driving me insane!


I'm not sure if this is a bug in Spark or what the heck is going on. As soon as I add a EditUserName.aspx page I'm not getting a 404 error anymore and it's working properly, by reshowing the page no problem??? How the heck are other people not running into this issue? I've read everything I could find and I don't see anything wrong with what I'm doing. Why would it work with the regular view engine? I so don't want to switch back to using the other one just for user input but I feel like I have no other choice here.



<form action="/User/EditUserName/<%= ((EditUserNameViewData)ViewData.Model).User.Id %>/<%= ((EditUserNameViewData)ViewData.Model).User.UserName %>" method="post" class="span-15 last">
<input type="text" id="newUserName" name="newUserName" />
<input type="submit" id="chooseNewName" value="Choose new Name" />
share|improve this question

1 Answer 1

up vote 0 down vote accepted

I was calling Html.RenderAction within my master page. I was "post"ing my form, but my action method had a [AcceptVerbs(HttpVerbs.Get)] attribute on it - this was forcing a 404 error not found and it was obviously my fault. Super glad I figured it out, but geez what a pain.

share|improve this answer

Your Answer


