ASP.NET MVC - Wrong redirecting, how to debug?
- by Xorty
I am stuck with redirecting problem in ASP.NET MVC project. I have mapped tables via LINQtoSQL and each has unique ID as primary key.
I am implementing functionallity of 'CREATE'. Basically, after new value is added into SQL table (which means I pressed Save button), I want to be redirected to Details of this freshly added item.
Here's little code how I am doing it :
[AcceptVerbs(HttpVerbs.Post), Authorize]
public ActionResult Create(Item item) {
....
return RedirectToAction("Details", new { id = item.ItemID });
Trouble is, I am never redirected to Details view (I have Details.aspx view for items).
When I check CallHierarchy in Visual Studio (2010 pro) the hierarchy is indeed little strange, like this :
RedirectToAction(string,object)
Calls To 'RedirectToAction'
Create
Calls To Create (no results)
Calls From Create (methods of created instance. From there I'll get back to 'RedirectToAction' and to 'Calls to Create' and 'Calls From Create' etc. etc. - loop
Edit
Calls From 'RedirectToAction'
Not supported
I am looking for some tools or more specifically 'know how' (since VS probably has some tools) to debug this kind of situations.
PS: rooting is default :"{controller}/{action}/{id}",
Thanks