IControllerFactory ... did not return a controller for the name "Rss",

I have a controller called RssController that looks like this

public partial class RssController : MVCExceptionBaseController { public virtual ActionResult Display() { var viewModel = new RssList(); return PartialView("Display", viewModel); } } 

When I click on the "Login" link in my navigation, I get the following message:

The IControllerFactory "GodsCreationTaxidermy.Helpers.StructureMapControllerFactory" do not return the controller for the name "Rss".

RSS is called from Site.Mater, for example:

 <% Html.RenderAction("Display", "Rss");%> 

A display is a partial class that is used to display an RSS feed, and looks like this:

 <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <ul> <% RssList viewModel = ViewData.Model as RssList; if (viewModel.Feeds.Count() > 0) { foreach (SelectListItem item in viewModel.Feeds) { %> <li> <% Response.Write(String.Format("<a href='{0}' target='_blank'>{1} More</a>", item.Value, item.Text.TruncateString(30))); }%> </li> <% }%> </ul> 

Any other links that I click work fine except Login (LogIn is in its own area, could this be the reason, if so, how would I decide to solve it?)

+4
source share
1 answer

By default, the Html.RenderAction method will not search for controllers outside the current scope. In order for the controller inside the login area to detect the Rss controller, you need to use one of the overloads of the RenderAction method:

 <% Html.RenderAction("Display", "Rss", new { area = "" }); %> 

The "empty string" area is a container for any controller that is not part of the area.

+7
source

Source: https://habr.com/ru/post/1385712/


All Articles