laravel 4 url redirect cache - laravel

In my app, Home is the default Controller set.
I am having a Main controller which redirects to home page if a particular session variable is not set.
After Login validation, session is created for the user and redirects me to home page. On home page when I click on the link to main page "http://domain/main" it redirects the user to home page again.
when i type "http://domain/main/" in the url, it opens the right page. but "http://domain/main" is redirecting to "http://domain/home".
when i clear session files in storage and login "http://domain/main" works but after some time it redirects me to home page again.
I believe there is issue with laravel caching as in my code the redirection handling is perfect.

Sometimes browser caches the redirect 301 url. So in your code if you set session variable on some condition. and you redirect(301) to a page on set of a session variable than your browser caches that redirection.
So if at first session variable is not set, and your code redirects(301) to a different link. next time when you set variable on client interaction and your session variable is set, even than your browser will redirect you to the cached link. to avoid that you must pass redirect http code to the redirectto('location url','302') function in laravel.

Related

Oracle apex home page the checksum computed did not match the checksum passed into the show procedure

I have this apex application where the logout url redirects you on the Home page that is created by apex when you first create the application.
On that page we have 3 buttons, 1 that takes you to the login page, 1 to register, and 1 to the real home page of the application in case the page is reached when the user is already logged in(which should normally not happen).
The issue is now when the session expires, the user is redirected to this Home Page as the logout URL is set to point to the Home Page, but this does not happen as the user gets an error:
apex_error_code: APEX.SESSION_STATE.SSP_VIOLATION2_FOR_DEVELOPERS
original message: The checksum computed on the request, clear cache, argument names, and argument values (,3420 [xxxxxxxxx]) did not match the checksum passed into the show procedure (yyyyyyyyy).
Note: End-users get a different error message.
I checked the home page and the configuration is as below:
The printscreen of configuration:
I am new to apex and don't understand really well how this should work.

Wicket Submit BehaviorListener after RestartResponseExeption and Session replacement

I have a AjaxFallbackLink to add a product into the wishlist of a customer. When a guest clicks the Link he is redirected to the login page with a RestartResponseAtInterceptPage. After successful login he returned to the first Page. But the URL contains the IBehaviorListener of my "add to wishlist" Link and every Ajax Link does nothing except to reload the page with no changes. I think the problem is the incorrect match of Page instance and BehaviorListener instance because my Page started with instance 1 and returned with instance 4 from Login Page. Everything works when the guest is already logged in.
How can i remove the illegal URL parameter or call the right Link callback to add the product to wishlist after successful login?
I think you need to do the following, in YourApplication#init() add:
getPageSettings().setCallListenerInterfaceAfterExpiry(true)
You can override it per Page if you don't want to enable it globally, see org.apache.wicket.Component#canCallListenerInterfaceAfterExpiry()

wordpress: how to force a form fill before going to a page?

I am building a wordpress site with this requirement: when the user attempts to navigate to certain pages, they will be forced to fill out a small form (enter their email address) before they can get to the desired page.
On a standalone site, I'd do it like this: on each "protected" page, I'd look for a cookie named "email". If this cookie doesn't exist, redirect to an email capture page, along with a url parameter indicating the page to go to after they enter their email. The email form would call a PHP script that would set the "email" cookie, then redirect to the desired page
How to do this in wordpress? Would I create my cookie testing code in a template and assign that to the protected pages?
Create a template and page for your php code and when user try to navigate to protected pages check for cookie if doesnt exist go to email page (instead it would be fine if the form appears in a pop up window).There when you get the email onsubmit use ajax to go create cookie from php page and once the cookie is set the navigation should take place .you should create a template for the php page ,and give the page id in ajax code
I hope this is what u r looking for.

Global approach to redirect on login page in MVC3

I want to know how I can design my application using global approach for such scenario
Redirect on login page if user does not authenticated or session has expired
Redirect on login page if user does have other role and try to access page which does not fall under that role.
Redirect on login page if requested for page that does not present in application.
Basically you can create a ActionFilter see this:
http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/understanding-action-filters-cs
Or Another shortcut way to do this in MVC3 you can check Session or authentication in Master page top of the page razor code ie: _LayOut.cshtml like this:
#model CustomerModel{
if(Session["CustomerId"]==null)
RedirectToActionResult("Index","Home");
}
Note: For this you need to inherit all of your views with _LayOut.cshtml and don't inherit /Home/Index view with master page because It will run recursively and you got timeout error.

MVC link text from address bar

I have made a website with MVC and I have a little problem on routing: the link addresses from address bar appears with some strange paramaters like:
http://localhost:1413/Account/LogOn?ReturnUrl=%2f
instead of
http://localhost:1413/Account/LogOn
What should I do to have customized addresses.
I don't use any parameters.
The ?ReturnUrl=%2f portion of the Url is added by ASP.NET when a user is automatically redirected to the login page. Its added so that after the user logs in, they can then be redirected to their original page.
In this case, %2f represents the / meaning that the user tried to access the landing page and was subsequently redirected to the logon page. After they login successfully, they will then be redirected to the landing page.
You can still use the http://localhost:1413/Account/LogOn

Resources