Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:40:49+00:00 2026-05-21T07:40:49+00:00

For some reason, one of my Html.Action() methods is throwing a StackOverflowException which is

  • 0

For some reason, one of my Html.Action() methods is throwing a StackOverflowException which is only being caught when I debug the web server instance after it gets stuck and stops responding. All what I get is this:

System.StackOverflowException was
unhandled

Cannot evaluate expression because the
current thread is in a stack overflow
state.

The line that is throwing the exception is this:

<div id="userInfoSummary">@Html.Action("Summary", "User")</div>

This happens when I login and then get redirected to the home page (which never happens because it gets stuck.

Here’s how I check whether the user is logged in or not to render the view approriatly:

<div id="userPanel">
                @if (!SessionManager.CheckSession(SessionKeys.User))
                {
                    <div id="loginForm">@Html.Action("Login", "User")</div>
                    <div id="registerForm">@Html.Action("Register", "User")</div>
                    <hr class="greyLine" />

                    <div id="recentlyViewedItems">
                        <div id="recentItemsTitle">
                            <span class="recentItemsIcon"></span><span class="theRecentTitle">Recently Viewed</span>
                        </div>
                    </div>
                }
                else
                {
                    <div id="userInfoSummary">@Html.Action("Summary", "User")</div>
                } 
            </div>

And here are my ActionMethods:

    [HttpPost]
    public ActionResult Login(LoginViewModel dto)
    {
        bool flag = false;
        if (ModelState.IsValid)
        {
            if (_userService.AuthenticateUser(dto.Email, dto.Password, false)) {
                var user = _userService.GetUserByEmail(dto.Email);
                var uSession = new UserSession
                {
                    ID = user.Id,
                    Nickname = user.Nickname
                };
                SessionManager.RegisterSession(SessionKeys.User, uSession);
                flag = true;
            }
        }
        if (flag)
            return RedirectToAction("Index", "Home");
        else
        {
            ViewData.Add("InvalidLogin", "The login info you provided were incorrect.");
            return View(dto);
        }
    }

    public ActionResult Summary()
    {

        var user = _helper.GetUserFromSession();
        var viewModel = Mapper.Map<User, UserInfoSummaryViewModel>(user);
        return View(viewModel);
    }

How can I get more information about this exception? And why is this happening in the first place? I do not think there are any recursive functions that are going endlessly or some infinite loop… Could it be that I’m calling several Html.Action() methods at the same time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:40:50+00:00Added an answer on May 21, 2026 at 7:40 am

    You shouldn’t in any case be placing the Html.Action call in the Summary view or it will recursively call itself until you run out of stack. If the call is placed in the _Layout of the site ensure that you are returning a partial view in the Summary action so that this layout is not included:

    public ActionResult Summary()
    {
        var user = _helper.GetUserFromSession();
        var viewModel = Mapper.Map<User, UserInfoSummaryViewModel>(user);
        return PartialView(viewModel);
    }
    

    or if you don’t want to modify your Summary controller action you could do the following in the Summary.cshtml partial:

    @{
        Layout = null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason during loading one of the scenes in my game, the background
for some reason (and I think I know why), when more than one row
Over the weekend, for some reason, one of our servers has decided to start
I have some classes that, for one reason or another, cannot be or need
For some reason this isn't working, am I missing something obvious? RewriteRule ^(.*)infopopup.html$ /acatalog/infopopup.html
Ok, this is an odd one for some reason. UPDATE is updating fields, but
Alright, I'm having an issue with logic flow. For some reason one of the
For some reason...maybe looking at too many different examples...this is one of those things
I've created a login submit form in HTML but for some reason user/password autocompletion
For some reason I can't seem to get this particular web page's contents via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.