How to identify the visitor's country and the visitor's country

Source: Internet
Author: User
Tags tidy maxmind

How to identify the visitor's country and the visitor's country

During website construction, visitors in different countries may need to display different information. In particular, the international requirements for the language used by websites, such as displaying English for American visitors and Chinese for Chinese visitors.

There are two ways to solve this problem.

I. Use the CultureInfo and RegionInfo classes
public static string GetISORegionName(HttpRequest request){    var lan = request.UserLanguages.First();    var cultureInfo = CultureInfo.CreateSpecificCulture(lan);    var regionInfo = new RegionInfo(cultureInfo.LCID);    return regionInfo.TwoLetterISORegionName;}
  • Obtain the language used by the visitor client through Request
  • Generate CultureInfo by the language code
  • RegionInfo is generated by the LCID of the generated CultureInfo
  • Obtain the TwoLetterISORegionName value of RegionInfo, that is, the country/region represented by two letters in ISO 3166.

* Clients that use the Chinese environment (zh-CN) will get the result of "CN", while clients that use the English environment (en-US) will get the result of "US ".

* This method obviously has a problem. The judgment result depends on the visitor's client language environment rather than the actual location of the National Geographic.

2. Use MaxMind's free database and related APIs

Obtain the corresponding national geographic location through the IP address. You can use the database provided by the data supplier to obtain the corresponding information in general query mode. However, these databases are usually charged.

Of course, there are also free products, such as free databases released by MaxMind.

Database: http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz

The required dll can be obtained by the NuGet method. PM> Install-Package MaxMind. GeoIP2. After the installation is complete, two dll references, MaxMind. Db and MaxMind. GeoIP2, will be added to the project.

Before calling the GeoIP2 API, you need to complete a task to obtain the visitor's IP address.

The simplest way is to use HttpContext. Current. Request. UserHostAddress. However, when a visitor uses a proxy server, the IP address obtained by this method is incorrect.

To change the method, use the following code:

public static string GetClientIpAddress(HttpRequest request){    var userHostAddress = request.UserHostAddress;    var xForwardedFor = request.ServerVariables["X_FORWARDED_FOR"];    if (string.IsNullOrEmpty(xForwardedFor))        return userHostAddress;    var forwardingIps = xForwardedFor.Split(',').ToList();    return forwardingIps.Any() ? forwardingIps.Last() : userHostAddress;}

After completing this step, you can go to the topic and call the GeoIP2 API to obtain the visitor's country.

public static string GetISOCodeByMaxMind(HttpRequest request){    using (var reader = new DatabaseReader(HttpContext.Current.Server.MapPath("~/GeoLite2-Country.mmdb")))    {        var ipAddress = GetClientIpAddress(request);        var country = reader.Country(ipAddress);        return country.Country.IsoCode;    }}
  • Instantiate DatabaseReader and use the path of the database as the parameter of its constructor
  • Obtain the Client IP Address
  • The country where the IP address is located.
  • Obtain the IsoCode of the country, which is also represented by two letters in ISO 3166.

* If the corresponding information cannot be obtained from the database, the above method will throw an exception, so it is necessary to add a try/catch statement to control it during actual development.


How can foreign trade personnel receive visits from foreign customers?

Therefore, business personnel should carefully prepare how to receive foreign businessmen. 1. First, confirm the customer's intention to visit your company. When the customer proposes to visit your company, ask the foreign trade personnel to know from the customer when and how long it will take to stay here, main purpose of the visit. Second, Foreign Trade personnel should also adjust their own mentality. Some people may be afraid of making mistakes or fail to communicate normally when receiving foreign trade for the first time. In fact, you are not worried. Foreign Businessmen only want to learn more about your company and products, so you can treat them with a normal mind. 2. After the itinerary is scheduled to determine the time for foreign businessmen to visit and the purpose of the visit, the salesman will begin to arrange the itinerary for foreign businessmen. After the arrangement is made, the salesman will send an email to the foreign businessmen for confirmation, in the course, it is best to clearly specify the products to be seen by foreign visitors, as well as some industrial equipment, warehouses, etc. The actual visit is carried out in strict accordance with the schedule. 3. Understand the information of the foreign trade clerk. The foreign trade clerk must understand the process and technical parameters of his company so that you can take a good tour of the Foreign Trade and explain it to him. 4. Understanding the guest information is mainly for the foreign trade personnel to prepare for arranging accommodation and other issues. They need to know the age, education, hobbies, positions, and religious beliefs of the guest, most people abroad have faith, and some taboos of different religions should be avoided. 5. Prepare the materials for the visit so that the workshop can be prepared. Prepare the tools, technicians, and technical guides used during the visit. Prepare a notebook, write down the dimensions, specifications, and requirements mentioned during the visit. This facilitates the next negotiation. Vi. airport pick-up and hotel arrangement if you know about and confirm the customer's visit time, you should book a hotel in advance and pick up at the airport on time, this gives customers a sense of being at home and will also benefit your company image. Then you can ask the customer about the itinerary. If you want to visit your company right away, go straight to the theme. if the customer is tired, don't disturb the customer. 7. After all the visits, the negotiation will begin. At this time, the customer will express their thoughts and opinions. In this process, we will give full play to your negotiation skills and strive to let the customer return to the market, of course, you need to be profitable. 8. After arranging a harmonious business for a restaurant, we need to arrange for customers to have meals and ask what they like, ask them what kind of restaurant they want to eat (in terms of meals, the clerk must pay attention that some dining table manners vary in different countries, so they must know the country, hobbies, interests, and religion of the customers before) 9. After sending customers away and finishing their respective offices, this business is also a complete conclusion. You can give the guests some small gifts after the visit. The gifts do not need to be too expensive, but only represent your mind. If the customer's itinerary is not over yet, you can take the customer's entertainment venues or enjoy the local scenery. Then, the guests will be taken directly to the airport after the conclusion, so the whole process will end. After the customer returns home, he must contact the customer in time to express his greetings. In addition, he hopes that the visit will better promote trade between the two companies.

On the important role of employee etiquette in establishing the image of tourism enterprises

Let's talk about the importance of employee etiquette norms at the beginning and end with yourself.
Employee etiquette specifications
Chapter 1 Instrumentation
Section 1 grooming, wearing and posture
Hair: clean, tidy, no dandruff, no hair dye, no strange hair style. Men do not have long hair, women do not have to carry shoulder hair, and do not have to provide gorgeous headwear
Eyes: No eyelids, no sleep, no congestion, no strabismus. Clear and bright glasses. Do not wear sunglasses or colored glasses. Women do not have eye shadows or artificial eyelashes.
Ears: clean inside and outside, No Ears. Women do not wear earrings.
Nose: Clean nostrils, no runny nose. Nose hair is not exposed.
Shave: shave clean or tidy, without a long beard, without a peat or other strange beard.
Mouth: the teeth are neat and white, and there is no smell in the mouth, no foam in the mouth of the mouth, and no chewing gum or other foods during reception. Women do not need dark or gorgeous lipsticks.
FACE: clean, no obvious acne. Women apply proper powder without leaving any trace.
Neck: do not wear a necklace or other ornaments.
Hand: clean. The nails are neatly arranged without long nails. Do not wear nail polish or wedding rings.
Hats: neat, regular, color and shape match your age and identity.
Shirt: Keep the neckline and cuffs clean. Do not roll your sleeves. The texture, style, and color match with other costumes, and match your own age, identity, and company personality.
Tie: neat and tidy. The texture, style, and color match with other costumes to suit your age, identity, and company personality. Should not be too gorgeous or dazzling
Suit: neat and straight, no hair or dandruff on the back. Not wrinkled, but not gorgeous. Matches shirts, ties, and trousers. When talking or greeting a person, buckle the first button. Do not insert a pen into your upper pocket. Do not drum up your pockets for wallet, business cards, cigarettes, lighters, and other items.
When men wear a suit, pay attention to three points: the first and third-color principles, meaning that the color of the whole body is limited to three colors, and the three colors refer to the three major colors. The second and third laws, the color of the shoes, belts, and briefcase should be one color, generally black. The third and third taboos, 1. The taboo trademark must be removed. 2. The color of the taboo so should be dark, 3. Taboo tie style. Wear non-professional clothes and short sleeves without a tie, and wear a jacket without a tie. When wearing a business tie, the arrow of the tie should be on the top of the belt buckle.
Badges and female clothing: Badges and badges are correctly worn. Do not wear badges irrelevant to work. The chest should not be exposed. Clothes are neat and wrinkle-free. Professional wear, no fashion, dress, evening wear, casual wear, transparent wear, sleeveless wear and ultra-short skirts.
Women are not allowed to wear professional dresses: 1. They cannot wear black skins (International conventions) on the occasion; 2. Formal and advanced occasions cannot wear bare legs; 3. They cannot be damaged; 4. Shoes and so are not supported. 5. "Three-legged ".
Belt: higher than the navel, tight and moderate, do not use weird skin to take the lead.
Shoes and SOEs: Suitable for combination. Fasten your shoelaces. The upper is clean and bright, dust-free soil and dirt, should not be nailed to the iron, heel should not be too high, too thick and strange. The sock is clean and has no odor, so it does not expose its legs. Women wear flesh-colored so or stockings. Do not fade or strip the so.
Dress code 6: first, not too messy; second, not too bright; third, not too exposed; fourth, not too bright; fifth, not too short; sixth, too tight,
Considerations for ladies makeup
Basic requirements: Apply for makeup.
Note: 1. Make-up should be natural, without obvious traces; 2. Make-up should be beautified, not over-and avant-garde; 3. Make-up should be avoided, not when the guests make-up.
Standing
Male standing posture: His feet are opened in parallel, and his hands are in front of the lower abdomen. When the following personnel come, they should stand up: customers or guests; superiors and positions higher than themselves; female employees at the same level as themselves.
The female is standing close together with her feet, her knees straight, and her hands in front of her abdomen.
Just seat
Male seat: generally from the left side of the chair seat, close to the back of the chair, straight upright, do not lean forward or backward, hands stretch or gently hold on the knees, parallel feet, separated by a fist distance, the thigh and calf are 90 degrees. If you are sitting on a deep and soft sofa, you should sit at the front end of the sofa and do not lean on the sofa to avoid nose exposure. Taboo: Erlang legs, shoes, put your feet on your own tables and chairs, or rack them on others' tables and chairs.
Female seat: Your feet cross or close together and put your hands on your knees.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.