Welcome Guest, Not a member yet? Register   Sign In
redirect()->to() problem on IE
#1

(This post was last modified: 12-10-2021, 05:14 AM by anishvm.)

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?
Reply
#2

(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. :-)
Reply
#3

I use a named route for my dashboard and it works fine with Chrome, I gave up on IE years ago.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(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"
Reply
#5

(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
    }
}
Reply
#6

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(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
Reply
#8

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB