Html.ActionLink NullReferenceException

Posted by Community Admin on 04-Aug-2018 18:09

Html.ActionLink NullReferenceException

All Replies

Posted by Community Admin on 18-Oct-2012 00:00

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.

Posted by Community Admin on 06-Feb-2013 00:00

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.

Posted by Community Admin on 11-Feb-2013 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Oct-2013 00:00

So how do you fix this? 

Posted by Community Admin on 08-Oct-2013 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed