Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi - Quick question

I want to have a page that when the user hits it for the first time they get asked what region they are from - eg, europe, usa or australia.

I am lookng to set a cookie based on what region the user has picked on my page - so that the next time they come to the site they dont have to choose and are redirected to the appropriate site. Does anyone know how this would be done?

Thanks for your help
Posted

1 solution

This will get you started with cookies.

ASP.NET Cookies Overview[^].

You could present them with a drop-down containing a list of countries and ask them to select. Once selected create a cookie. Next time in attempt to read the cookie. If it's there don't display the drop-down since you know where they are from otherwise start again.

Note that you might be better to persist this information in a database as cookies do get deleted or are not always allowed.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900