Html.ActionLink NullReferenceException
I had changed my controller and model and designer namespaces so they don't have the default SitefinityWebApp namespace. Now I get a NullReferenceException on my pages where I use Html.ActionLink. Before, the links rendered (with the wrong path, but at least they didn't crash). I can probably figure out how to fix the routing, but I'm stuck on the crashing.
It fails here:
Telerik.Sitefinity.Mvc.SitefinityMvcRoute.EnsureActionExistsOnController(Type controllerType, String actionName)
The controller exists (Contact). The action exists (Index). I can get to the controller/view just fine if I make a page with the Contact widget, so it is clearly there, and Sitefinity can see it. But Sitefinity can't figure it out from an ActionLink.
I just ran into this issue on my desktop machine. Other devs running the same code base did not throw the exception. I ultimately attributed it to IIS. Once I restarted IIS, the Action was found with no problem.
Hi,
When changing the the default project namespace check if adding new MVC widgets works as when registering the controllers for MVC widgets sitefinity looks for an assembly that starts with "SitefinityWebApp" ( this is to be changed to allow better flexibility). If the new project assembly name doesn`t contain "SitefinityWebApp" the controllers will not register.
Also this can be of help.
All the best,
Stanislav Velikov
the Telerik team
So how do you fix this?
Hello,
The problem here appeared to be caused from having the assembly where the assembly name doesn`t contain SitefinityWebApp and this causes the controllers in sitefinity to stop functioning. If this is the cause please rename the sitefinity project assembly to be having a name that contains SitefinityWebApp in it.
Regards,
Stanislav Velikov
Telerik