Session storage being cleared on selecting the url and press enter - url

I am using a session storage value to verify the user to redirect to other page or not.
like ex :- if session storage doesn't exists go to verification url then if successful adding session storage value true goes to next page. page.url
The problem is when he is on page.url when i select the url and clicking it , the session storage which i created is not there and going back to verification url and when i click back the session storage is there for this particular page but it is working fine when i do a normal reload and hard reload.
Can someone explain what is happening here

Related

how can i change the view when the url changed in ios webview app?

I created an ios Webview app and it loads a specific URL which is a login page. User fills the username and password and then click login.
I want my app to check the URL after clicking on login, that if URL changes to another URL (I mean if the entered user and pass is correct) the previous URL changes to a new one which I want and goes to next view with a new URL.
I would appreciate if you helped me with this instantly.

how to redirect webpage based on user preference?

I'm looking to implement a functionality from NewEgg website. Once you visit newegg.com, it does a location detection and a popup will ask you whether you want to be redirected to your country-specific subdomain/website. Once you allow the website gets redirected. For eg. If you are in Hong Kong, the site gets redirected to https://www.newegg.com/global/hk/
Next time you open the browser and type newegg.com it automatically gets redirected to Hong Kong website.
How do they do that? How to implement this type of functionality?
I'm assuming they store a cookie, but how to do the redirection using that cookie?
You can simply do this by setting an cookie. Let save a cookie named locationlogged which contain user details, IP, location and anything else you want to store. Also preform this cookie check on newegg.com always. So when any user visit newegg.com you should call Cookie Cheker function to check wheather user previously selected any location or not. If set then get location value from cookie and redirect to new domain.
Make sure always call cookie checker function after loading dependency, libraries, html files. Otherwise sometime it may produce bad redirection warnings.
It would be good if you can show a popup on newegg.com saying "Hey ! we found your previous selected location. Is it right ?" and show buttons like redirect to selected or change location etc.
More you can also see how to do this in Jquery here : Cookie based Redirection using Javascript

Read session or cookie on CallBack

We have ASP.NET MVC 3 application which is integrated with Google Checkout API. Is there a way to access Session or Cookie of the Site on Google Checkout CallBack?
Suppose, I have logged into my site with UserID: ramiz and Password: r#miz. After I provided my credentials on Login it collects more details about me and put them in session (like, First and Last Name). Once I get in, I see a list of (used) iPhone. There, I see a cheap deal offering iPhone 3G only $150. There is a button of "Buy Now" in front of that deal. I click on this it ask me some more data and finally take me to the Google Checkout to do the transaction and place the order. I did and it shows me a "Thanks" message which means the transaction is completed successfully.
When we checkout Google calls our defined CallBack URL where we can collect the Nofitication XML which has Order Details. We are getting that Notification XML and happy to see all details is in there which we required. Here, we need to access the user Session or Cookie to get his First/Last Name and UserID. We have tried to access the Session/Cookie but it seems fail.
How do we have access Session or Cookie here? Or is there any good way of doing this?
Thanks.
Cookies (including session cookies) can only be accessed if the client (browser) actually goes back to your web site (if they do).
You can look into storing the data in:
merchant-private-data (order level)
merchant-private-item-data (item level)
instead of cookies. These will be echoed back to your handler in new-order-notification.

Restricting page url to be opened into another by simply copying and pasting

When i Copy my url after logging into another browser it displays the same page instead of login page .This happens even after i close my page
Modify your session handling. The session ID should not show up in the URL (or at least not be used alone for authorization of the request).

Why does Spring Security go to last page before logout when I log out and log back in?

I have a web application running on Spring Webflow with Spring Security. I have a problem logging out because my app kinda remembers the last page after logging out. When I press back or directly paste the URL to the address bar it can direct the page to the login page, but if I login it will go directly to the last page I went to before logging out. It tends to remember its last state. Below is my application-config snippet.
<security:logout logout-url="/logout.do" invalidate-session="true"
logout-success-url="/logoutSuccess.do" />
Link in my page
#{label.labellogout}
The expired-url attribute
The URL a user will be redirected to if they attempt to use a session which has been "expired" by the concurrent session controller because the user has exceeded the number of allowed sessions and has logged in again elsewhere. Should be set unless exception-if-maximum-exceeded is set. If no value is supplied, an expiry message will just be written directly back to the response.
Sounds like your session is still valid after an Logout. try to make it invalid after logout.
Text is from:
Spring Doc
Not sure that I correctly understand your problem but:
B.1.1.4. session-fixation-protection
Indicates whether an existing session should be invalidated when a user authenticates and a new session started. If set to "none" no change will be made. "newSession" will create a new empty session. "migrateSession" will create a new session and copy the session attributes to the new session. Defaults to "migrateSession".
If enabled this will add a SessionFixationProtectionFilter to the stack. The session fixation protection options on namespace-created instances of AbstractProcessingFilter will also be set appropriately.
Can be read here link

Resources