CodeIgniter Forums
redirect()->to() problem on IE - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: redirect()->to() problem on IE (/showthread.php?tid=80729)



redirect()->to() problem on IE - anishvm - 12-10-2021

I am getting error from IE when I redirect to "dashboard" controller after settings session values in "login" function ( return redirect()->to(base_url('dashboard')); ). I have this working on Chrome, Firefox, Edge, and Opera.

I am using public $sessionDriver = 'CodeIgniter\Session\Handlers\DatabaseHandler'; for session storage. this works well with other borwsers.

Any suggestions on what went wrong with IE?


RE: redirect()->to() problem on IE - kenjis - 12-10-2021

(12-10-2021, 04:16 AM)anishvm Wrote: I am getting error from IE when I redirect to "dashboard" controller after settings session values in "login" function ( return redirect()->to(base_url('dashboard')); ). I have this working on Chrome, Firefox, Edge, and Opera.

What error? What happened? What did you see?
If you show us, it might help to support.

And I recommend you not to use IE, it is going to die in a year. :-)


RE: redirect()->to() problem on IE - InsiteFX - 12-11-2021

I use a named route for my dashboard and it works fine with Chrome, I gave up on IE years ago.


RE: redirect()->to() problem on IE - anishvm - 12-12-2021

(12-10-2021, 10:46 PM)kenjis Wrote:
(12-10-2021, 04:16 AM)anishvm Wrote: I am getting error from IE when I redirect to "dashboard" controller after settings session values in "login" function ( return redirect()->to(base_url('dashboard')); ). I have this working on Chrome, Firefox, Edge, and Opera.

What error? What happened? What did you see?
If you show us, it might help to support.

And I recommend you not to use IE, it is going to die in a year. :-)

We still have a few users who are using Internet Explorer.
The error message says:

"Can't reach this page"
Under more information:


"The connection to the website was reset.
Error Code: INET_E_DOWNLOAD_FAILURE"


RE: redirect()->to() problem on IE - anishvm - 12-12-2021

(12-11-2021, 02:40 AM)InsiteFX Wrote: I use a named route for my dashboard and it works fine with Chrome, I gave up on IE years ago.

I still have a few users wwho are using IE.

This is where I call the 'dashboard' controller after settting the session values
--------------------------------------------------------------------------------------------
// Stroing session values
                $this->setUserSession($user);
                $temp = session()->get();
               
                // Redirecting to dashboard after login
                return redirect()->to(base_url('dashboard'));
----------------------------------------------------------------
This is "dashboard" controller

namespace App\Controllers;

use App\Controllers\BaseController;

class Dashboard extends BaseController
{
   
    public function index()
    {
        return view("dashboard");
    }
}

----------------------------------------------------------------------
This is route

$routes->match(['get', 'post'], 'register', 'User::register', ['filter' => 'noauth']);
$routes->match(['get', 'post'], 'login', 'User::login', ['filter' => 'noauth']);
$routes->get('dashboard', 'Dashboard::index', ['filter' => 'auth']);
$routes->get('profile', 'User::profile', ['filter' => 'auth']);
$routes->get('logout', 'User::logout');

---------------------------------------------------------------------
This is 'auth' filter


namespace App\Filters;

use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;

class Auth implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        if (!session()->get('isLoggedIn')) {
            return redirect()->to(site_url('login'));
        }

    }

    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {
        // Do something here
    }
}


RE: redirect()->to() problem on IE - InsiteFX - 12-13-2021

Try this, it's how I do it.

PHP Code:
$routes->get('dashboard''Dashboard::index', ['filter' => 'auth''as' => 'dashboard']);

return 
redirect()->to('dashboard'); 

Let us know if it works.


RE: redirect()->to() problem on IE - anishvm - 12-13-2021

(12-13-2021, 02:05 AM)InsiteFX Wrote: Try this, it's how I do it.

PHP Code:
$routes->get('dashboard''Dashboard::index', ['filter' => 'auth''as' => 'dashboard']);

return 
redirect()->to('dashboard'); 

Let us know if it works.

Didn't help. When I checked IE console, found geting one message: 
"DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
logout
HTML1300: Navigation occurred.
dnserror.htm



RE: redirect()->to() problem on IE - InsiteFX - 12-14-2021

If your using IE then it is mostly a security setting in it.

1) Open Control Panel.
2) Click on Internet Options.
3) Click on the Advanced Tab.
4) Check your Settings.
5) Click on the Security Tab
6) Check your IE Security Settings.

If it's an IE problem you should find it in there.