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 8575321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:40:03+00:00 2026-06-11T19:40:03+00:00

After logout i want redirect to index page , but i getting an error

  • 0

After logout i want redirect to index page , but i getting an error in FOSUserBundle

In SecurityController.php

 <?php
      namespace ispg\Bundle\ChatBundle\Controller;
      namespace FOS\UserBundle\Controller;

      use Symfony\Bundle\FrameworkBundle\Controller\Controller;
      use Symfony\Component\DependencyInjection\ContainerAware;
      use Symfony\Component\Security\Core\SecurityContext;
      use Symfony\Component\Security\Core\Exception\AuthenticationException;

 class SecurityController extends ContainerAware
 {
     public function loginAction()
     {        
          $request = $this->container->get('request');
          /* @var $request \Symfony\Component\HttpFoundation\Request */
          $session = $request->getSession();
          /* @var $session \Symfony\Component\HttpFoundation\Session */
          $network = $request->get("network");

          // get the error if any (works with forward and redirect -- see below)
          if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
             $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
          } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) {
             $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
             $session->remove(SecurityContext::AUTHENTICATION_ERROR);
          } else {
             $error = '';
          }

          if ($error) {
              // TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523)
              $error = $error->getMessage();
          }

          // last username entered by the user
          $lastUsername = (null === $session) ? '' : $session->get(SecurityContext::LAST_USERNAME);

          //create the select tag for network selection
          require 'mnoNetworks.php';
          $selectHtml = "<select id=\"networks\">
                         <option value=\"\"> -- Select -- </option>";

          foreach($networks as $network){
             $selectHtml .= "<option value=\"".$network."\">".$network."</option>";
          }
          $selectHtml .="</select>";

          return $this->container->get('templating')->renderResponse('FOSUserBundle:Security:login.html.'.$this->container->getParameter('fos_user.template.engine'), array(
               'last_username' => $lastUsername,
               'error'         => $error,
               'network'        => $network,
               'networkSelector' => $selectHtml
           ));
      }

      public function checkAction()
      {
           throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
      }

      public function logoutAction()
      {
           $bundle2 = new \ispg\Bundle\ChatBundle\Controller\DefaultController();
           $bundle2->setContainer($this->container);
           $returned_data = $bundle2->san();
       }
 }

After logoutAction session I want to redirect to index page
how to redirect to it .

Is any one can solve this?

  • 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-06-11T19:40:04+00:00Added an answer on June 11, 2026 at 7:40 pm

    Jaitsu is right, it’s just that your Controller extends ContainerAware but not Controller class that provides shortcuts for basic controller actions…

    return new Symfony\Component\HttpFoundation\RedirectResponse($this->generateUrl('name_of_route'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I redirect to current url after logout? HTLM for logout: <a href=<?php
I'm having a little issue with some php logic in my main index page,
I am using python with django i want redirect users to login page when
After verifying/validating with provider, I want to logout from provider application (or invalidate provider
After discovering about Javascript namespaces, I tried to implement them but I run into
After following the RoR getting started tutorial, I added another model as: $ rails
After I click update in the grid view, the code works successfully. But when
After autheticating my user, I want to put a reference in the session to
so I want to do something like when you press on LogOut, you get
I want my web page to close when SessionState timeout occures. This is my

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.