2

I have a Controller called ActivationController with a LogOn action, which renders the view LogOn.aspx. LogOn.aspx renders a partial view called LogOn.ascx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    LogOn
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Account Activation Step 1 - Log On</h2>

    <p>
        <%Html.RenderPartial("LogOn")<;%>
    </p>

</asp:Content>

When calling the action i'm getting a "Stack Overflow" exception:

An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.Mvc.dll

Any clue?

Thanks in advance!

John Rasch
  • 62,489
  • 19
  • 106
  • 139
  • hello dear kindly please check this link. https://stackoverflow.com/questions/702746/how-to-include-a-partial-view-inside-a-webform – hamza Ali Nov 12 '21 at 14:10

2 Answers2

6

Don't bother to reply, i found the issue.

The problem was that partial view should have a different name than the view. :P

Thanks anyway!!

1

This looks wrong:

<%Html.RenderPartial("LogOn")<;%>

it should look like this:

<% Html.RenderPartial("LogOn");%>
Josh E
  • 7,390
  • 2
  • 32
  • 44