Controller being called multiple times while selecting menu item / every time page refresh

Nov 19, 2010 at 2:28 PM
Edited Nov 19, 2010 at 3:14 PM

Hello,

I am still in testing stage of this product.

Every time I select a Menu Item . All my controllers get called some multiple times.  I  think this may be because  of Security feature where each controller  and action needs to be verified for Authorization. Is this right. If so is there any way to cache it or disable security . I am looking for a simple menu and bread crumb generation.

Regards,

Shree Menon

 

Edit: If  you add a break point  as shown below in sample application you  will understand what I mean

 

   

 

 

public ActionResult

 

return

 

 

 

View();

 

 

}

}

}

 

SiteMap()

 

 

{

 

 

namespace
 
MvcMusicStore.Controllers 
{
 
public class HomeController : 
Controller
{
 
//
 
// GET: /Home/
/****          PUT A BREAK POINT ON STATEMENT BELOW   IT WILL EXECUTE more than 100 TIMES   ********** 
MusicStoreEntities storeDB = new MusicStoreEntities 
(); 
 
public ActionResult 
Index() 
{
 
// Get most popular albums
 
var 
albums = GetTopSellingAlbums(5); 
 
return 
View(albums); 
}
 
private List<Album> GetTopSellingAlbums(int 
count) 
{
 
// Group the order details by album and return
 
// the albums with the highest count
 
return 
storeDB.Albums 
.OrderByDescending(a => a.OrderDetails.Count())
.Take(count)
.ToList();
}

 

 

Nov 20, 2010 at 1:44 PM

Hello All,

Disabling Security trimming helped cut down on the number of times conrtoller is resolved.

 

Regards,

 

Shree Menon

Coordinator
Nov 22, 2010 at 6:13 AM

This has been optimized for the next release. Try the source code for the 2.3.0 branch.