gruber
gruber

Reputation: 29749

Recognize canadian user based on web browser settings

How can I determine if user is Canadian based on web browser settings?

I'm using Asp.net 2.0.

Upvotes: 0

Views: 169

Answers (1)

Preston Guillot
Preston Guillot

Reputation: 6724

Determining if "user is Canadian," is a pretty ambiguous statement. You can determine if a user's browser culture is set to something Canadian by inspecting HttpRequest.UserLanguages. Canadian English is en-CA, Canadian French is fr-CA.

If you're trying to determine if a user is actually sitting in Canada, the best you could hope for is to attempt to resolve location based on their IP, but this isn't going to be reliable. Here's a publically available serivce for doing that.

Upvotes: 2

Related Questions