ASP.NET MVC - Wrong redirecting, how to debug?
Posted
by Xorty
on Stack Overflow
See other posts from Stack Overflow
or by Xorty
Published on 2010-05-27T20:13:39Z
Indexed on
2010/05/27
20:21 UTC
Read the original article
Hit count: 247
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
- Create
- 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
© Stack Overflow or respective owner