+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Html.ActionLink NullReferenceException

Html.ActionLink NullReferenceException

5 posts, 0 answered
  1. vibrantice
    vibrantice avatar
    4 posts
    Registered:
    01 Oct 2012
    18 Oct 2012
    Link to this post
    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.

  2. Rich
    Rich avatar
    24 posts
    Registered:
    22 Oct 2012
    06 Feb 2013
    Link to this post
    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.
  3. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    11 Feb 2013
    Link to this post
    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
  4. Christian
    Christian avatar
    10 posts
    Registered:
    22 Aug 2013
    03 Oct 2013 in reply to Stanislav Velikov
    Link to this post
    So how do you fix this? 
  5. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    08 Oct 2013
    Link to this post
    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
5 posts, 0 answered