I have a web application which a user can enter from a number of different pages and follow a number of different paths through the application. I want to be able to add a back to start button to each page which the user can click to take them back to the page they entered the application at.
Currently the user is authenticated by cookie, so I can see what page the cookie is generated on store this and use the link for the back button. However, it is common for a user to open multiple tabs with the application in and enter through multiple entry pages and I want each tab to be able to direct the user back to the correct entry page.
I.e. the user enter the application at page 1 then browses to page 2 - the back button should link to page 1
The user then open another tab at page 3 and browses to page 4 - the back button here should link to page 3.
At this point if the user goes back to tab 1 and browses to page 5 the back button should still link to page 1 here and the back button in the other browser should link to page 3.
The only way I can think of to do this is store the session ID in the get/post request and pass it on every page - can anyone else think of an easier or more elegant solution?
Thanks,
Tom
Look at the documentation for $_SERVER['HTTP_REFERER']
Problem: if he is redirected from google...
Plus:you can hardcode a function that checks the domain :-)
Related
I have a simple xamarin application with splash screen, page 1 (Main Page), page 2 (New User), page 3 (user profile). So page 1 have to buttons new user and existing user.
When user click new user, the user get navigated to page 2. When user click existing user, the user sign in using ad b2c, then get redirected to page 3 which is the user profile.
Everything works as expected, however when the user sign in, the token is stored such that the user will be signed in automatically when the main page (page 1) is displayed.
What I want to achieve is that I only want the main page to be displayed to first time users only, such that when user create quit and reopen the app (after the splash screen is displayed), ideally the main page is next but I want the main page to be a different page (let me say page 4), the user selection for the first time (new user or existing user) should be remembered such that when user reopen the app, the new main page (page 4) will be shown after the splash screen then automatically navigate to the main respective page based on the user selection (either new user page or user profile page)
If you are looking for something about data caching in xamarin forms,
you can try Monkey Cache which enables developers to easily cache any data for a limited amount of time.
All data for Monkey Cache is stored and retrieved in a Barrel. You can check the full resource here:
https://github.com/jamesmontemagno/monkey-cache
I have a home page url http://localhost:3443/home1
In the index action of home1 I am having a session["Home"]=Home1.
I am having another home page url http://localhost:3443/home2
There i have a session session["Home"]=Home2.
Now the context is for some user the landing page is home1. So if they click on home button on the menu or or do any such activity they should land into home1.
For another set of users they should land into home 2 for whatever activity they do which leads to the home page.
Now the menu.it is a ascx control
Here we are checking the session value is home1 or home2.
Based on that we are redirecting the user to the desired landing page.
Now the problem that I am facing is when we copy
http://localhost:3443/home1 to another tab e.g. tab2 and from there we change it into home2 and then do some activity. And then come back to tab1, what happens the value gets overridden it taken the home2 session. Which leads to the wrong landing page on click of home link in the menu. Do you have any solutions for this problem?
I hope i have correctly explained the problem if not please let me know,I will explain further.
Session is for the connection which will include both tabs (for example why you can login to stackoverflow on one tab and then if you open a second tab you are still logged in)
As #Skuld mentioned, the session is for user connection to the site so if the user goes to another page he or she is allowed to go they can open this in a new tab keeping the original tab open, if these are form pages you might want to look at 14 AntiForgeryToken. also i noticed you said this happens in IE does this also happen in Chrome? if so you might want to look to see if IE is excepting cookies. you can add roles to the session and then authorize those roles to home1 or home 2 from your controller, you should be authorizing users and roles to pages in your code not within your session. its hard to help any more without any code to look at.
Hope this gets you on the right track.
Here is my Gwt App, I have many pages: CustomerPage, OrderPage,... Each of these pages will have a header that have a Login Panel on top & its own content in the middle like this:
1- Customer Page
____________UserName...... Password....... Login
Customer Content here.....
2- Order Page
____________UserName...... Password....... Login
Order Content here.....
This means user can sign in in any page, they don't need to go to homepage to sign in.
Then here is my question, When user is in a certain page (ex: CustomerPage) & if they Log out then:
1- Should I refresh the whole page or redirect users to a Logout Page, so if they want to reopen the CustomerPage, then the page will have to go through all the Initializing processes (onBind-onReveal-onReset...)
2- Should I just let user stay where they are, and when user clicks logout button then system will reset variables. By doing that, then if user logs back in, the page will run faster cos it doesn't have to go through all the (onBind-onReveal-onReset...). However, if i do that then it quite difficult for me to reset all the variables. I have to remember which variables already initialed at the time the page got loggined & try to reset it to null or empty string. If i miss resetting just 1 variable then i will have trouble.
Some big site like Google or Facebook are using the solution 1, ie when user signs out it will redirect to new page or go back to homepage.
Also If adopting the solution 1, then i just need to call Window.Location.reload(); & it will reset everything. Even user clicks Back Arrow, they won't be able to see the old data since everything was reset.
So:
Is it Good Practice to redirect to a new Page or staying at the same page When user logged out (GWT)?
When users click on a Logout button, they expect that they can walk away from a computer. If you continue to show the same page, someone else might gain access to the data.
The universally accepted approach is to hide all data (i.e. redirect to the login/home page or close the app completely) when a user logs out. That's what users expect, and this is what you must do.
It depends what you've got loaded into the browser. Log in/out via a page refresh will be slower and present lag to your user. If you properly cleanup after yourself on logout (delete server side session, unbind presenters, clear caches) then it is really optional to refresh the page.
The universally accepted approach is to hide all data (i.e. redirect
to the login/home page or close the app completely) when a user logs
out. That's what users expect, and this is what you must do.
If your session management server side prevents any RPC's once you've logged out, and you no longer present/cache data, this is not an absolute necessity. Use digression based on your app needs, size, load time, and the sensitivity of the data it conveys.
I would like to have a button that depending on where the user was on the site, it calls the appropriate controller and action.
I have a page with a back button.
People can arrive on that page trough:
a) link on the homepage.
OR
b) trough a link on another page (inside the same site).
If the user comes from the homepage, the back button should point to that controller and action.
If, however, the user comes from that other page, the back button should point to another controller and action.
How can we accomplish something like this?
Thanks a lot,
MEM
ps - History Back is of no use, because we cannot allow that button to link to an external site.
Well, if you can't use javascript to go back in the history, then you have an undefined case when some external site leads directly to the page. Let's assume that if the user arrived at the page via an external site, the back button should simply not appear.
Consider checking the $_SERVER['HTTP_REFERER'] and constructing the back button link based on that. Inspect the referer (parse_url() may be of particular service here), if it's not your domain, don't display the button, otherwise, pick someplace to send the user "back" to (probably just the whole referer URL).
Similar questions have been asked on SO, but I am still looking for a solution and not a workaround.
I am working on an Ajax based application and when the user clicks on the Browser Back Button it takes the user to the login page(every page after the login page is ajax loaded). Apparently, this is not what the user expected.
We recommended using Bread Crumbs to the client
*Page One >> Page Two >> Page Three*
but the client insists that they prefer to use the Browser Back Button. Is there a way where it is possible to somehow embed the Bread Crumb links to the Browser Cache...in other words, clicking the back button invokes the same actions which clicking the Bread Crumb links would?
Regards,
SB
You could use the RSH (reallysimplehistory) javascript library: http://code.google.com/p/reallysimplehistory/