I have a Controller named RssController which looke like so
public partial class RssController : MVCExceptionBaseController
{
public virtual ActionResult Display()
{
var viewModel = new RssList();
return PartialView("Display", viewModel);
}
}
When I click on the Log In link in my navigation I get the following message:
The IControllerFactory 'GodsCreationTaxidermy.Helpers.StructureMapControllerFactory' did not return a controller for the name 'Rss'.
The RSS is called from Site.Mater like so:
<% Html.RenderAction("Display", "Rss");%>
Display is a partial class which is used to display the Rss feed and it 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 I click work fine, except Login (LogIn is in it's own area, could this be causing the issue, if so how would I go about resolving it?)
By default, the Html.RenderAction method won't search for controllers outside the current area. In order for a controller inside the LogIn area to find 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 isn't part of an area.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With