SoFunction
Updated on 2025-03-08

C# Method to determine whether the access source is a search engine link

This article example describes the method of C# to determine whether the access source is a search engine link. Share it for your reference. The specific analysis is as follows:

This code determines whether the visitor comes from a commonly used search engine by obtaining the UrlReferrer. It is not completely accurate and can be used as a reference

/// Determine whether it comes from a search engine link/// Whether it comes from a search engine linkpublic static bool IsSearchEnginesGet()
{
if ( == null)
{
return false;
}
string[] SearchEngine = { "google", "yahoo", "msn", "baidu", "sogou", "sohu", "sina", "163", "lycos", "tom", "yisou", "iask", "soso", "gougou", "zhongsou","bing" };
string tmpReferrer = ().ToLower();
for (int i = 0; i < ; i++)
{
if ((SearchEngine[i]) >= 0)
{
return true;
}
}
return false;
}

I hope this article will be helpful to everyone's C# programming.