Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child actions are not allowed to perform redirect actions. #45

Open
Sebosek opened this issue Aug 10, 2015 · 1 comment
Open

Child actions are not allowed to perform redirect actions. #45

Sebosek opened this issue Aug 10, 2015 · 1 comment

Comments

@Sebosek
Copy link

Sebosek commented Aug 10, 2015

Sometimes, I don't know why, I got error "Child actions are not allowed to perform redirect actions." error message. This error comes from ˙@Html.Action("CookieLaw", "Home", true)˙ and CookieLaw action contains just one line:

public ActionResult CookieLaw()
{
    return PartialView();
}

and View for this action:

@if (ViewBag.IsCookieLawConfirmed == null || !(bool)ViewBag.IsCookieLawConfirmed)
{
    <script type="text/javascript">
        var CasinoLaw = function () {
            // public
            this.HideCookieLaw = function () {
                document.getElementById("casino-cookie-law").className += " hide";
                SetCookie("@Apollo.Casino.Frontend.Features.Attributes.CookieLawAttribute.COOKIE_LAW", 1, 3650);
            };
            // private
            var SetCookie = function (cookieName, cookieValue, nDays) {
                var today = new Date();
                var expire = new Date();
                if (nDays == null || nDays == 0) nDays = 1;
                expire.setTime(today.getTime() + 3600000 * 24 * nDays);
                document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/";
            };
        };
    </script>

    <div id="casino-cookie-law" class="cookie-law">
        <div class="wrapper">
            <button type="button" onclick="javascript: var c = new CasinoLaw(); c.HideCookieLaw();">OK</button>
            <p>@PortalInfo.GetText("Casino.CookieLawPolicy.Text")</p>
        </div>
    </div>
}

So, I'm not using redirect. Please tell me what information can I provide to help to investigate this issue...

@migig
Copy link

migig commented Sep 24, 2015

I had similar error. You must be performing a redirect in a child action somewhere. Just make sure if this is the case. Because you can't do that (the framework doesn't allow it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants