1
votes

I am trying to debug Sitecore MVC4 application. Overall it works fine, but for some reason i am unable to stop in the default Action. I am able to break in the .cshtml file. I am also able to break in the [HttpPost] Action Is it something specific to Sitecore. I developped stand alone MVC apps before, but never had this issue

 public ViewResult Login()
    {  
       [DEBUGGER DOES NOT STOP HERE ] return View();
    }

 [HttpPost]
 public ActionResult Login(CurrentSession currentSession, LoginViewModel model)
    {
        if (ModelState.IsValid)
        {
              ....... 
              [DEBUGGER STOPS HERE]model.LoggedIn = currentSession.LoggedIn;
              .......

        }
    }

I am trying to do some logic in the default action, but it looks like Sitecore does not see it. Could be some set up in the sitecore ? In my Rendering Item i set value for "Path" pointing to my Login.cshtml. Also set "Form Controller Name" = "Account" and set "Form Controller Action" = Login. Am i missing something? It is like Sitecore does not know there is an action perform "OnLoad" event

3
What is your question exactly?Itay Grudev
Why cant i break in this Action "public ViewResult Login()".user3412765

3 Answers

1
votes

Probably related to the caching-mechanism from Sitecore. Post requests aren't cached by Sitecore or ASP.NET, so that explains why the debugger is using that breakpoint. The Login-action that you're calling with a GET (probably through a rendering in Sitecore?) is most likely default cached by Sitecore and therefore not executed because it already has a cached version of the output. You can maybe disable caching on that item or maybe disable caching on your local environment.

0
votes

I had this issue before, make sure that your rendering (view rendering, controller rendering etc...) does not have 'Cacheable' checkbox set to on, whether on the rendering item itself, or on page item presentation. Also try to clear cache by going to /Sitecore/admin/cache.aspx page.

0
votes

Figured out my issue. I created a rendering as View Rendering and not as Controller Rendering. That is why Sitecore did not see default Action

Thanks to everyone who tried to help