UserAgentStringLibrary
It is at WebWorkContext.CurrentCustomer's part.
//check whether request is made by a search engine
//in this case return built-in customer record for search engines
//or comment the following two lines of code in order to disable this functionality
if (customer == null || customer.Deleted || !customer.Active)
{
if (_userAgentHelper.IsSearchEngine())
customer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);
}
and to _userAgentHelper.IsSearchEngine()
/// <summary>
/// Get a value indicating whether the request is made by search engine (web crawler)
/// </summary>
/// <returns>Result</returns>
public virtual bool IsSearchEngine()
{
if (_httpContext == null)
return false;
//we put required logic in try-catch block
//more info: http://www.nopcommerce.com/boards/t/17711/unhandled-exception-request-is-not-available-in-this-context.aspx
(I checked this page, but the url is not valid now)
bool result = false;
try
{
var uasParser = GetUasParser();
var userAgent = _httpContext.Request.UserAgent;
result = uasParser.IsBot(userAgent);
//result = context.Request.Browser.Crawler;
}
catch (Exception exc)
{
Debug.WriteLine(exc);
}
return result;
}
and to var uasParser = GetUasParser();
protected virtual UasParser GetUasParser()
{
if (Singleton<UasParser>.Instance == null)
{
//no database created
if (String.IsNullOrEmpty(_config.UserAgentStringsPath))
//UNDONE: maybe, throw an exception?
return null;
var filePath = _webHelper.MapPath(_config.UserAgentStringsPath);
var uasParser = new UasParser(filePath);
Singleton<UasParser>.Instance = uasParser;
}
return Singleton<UasParser>.Instance;
}
This library is used to parse information about user agents located at \App_Data\uas_20140809-02.ini file. Both of them (DLL and INI files) were downloaded at http://user-agent-string.info (was available for free). Now I see that this project is moved to https://udger.com/ on November 2014 with sone new pricing options. I've jusy contacted them trying to understand whether we can continue usage of the new project (still looking forward for reply)
这个库是用来解析用户代理信息 位于\ App_Data \ uas_20140809-02。ini文件。(DLL和INI文件)在http://user-agent-string.info下载(免费)。
我看到这个项目转到https://udger.com/在2014年11月重新的定价方案。我jusy联系他们试图了解我们是否可以继续使用新项目(仍然期待回复)
http://blog.csdn.net/defonds/article/details/8128165
UserAgentStringLibrary的更多相关文章
- Autofac
程序集准备 Assembly: Autofac/Autofac.Integration.Mvc/System.Web.Mvc/System.Web.Helpers/System.Web.WebPage ...
- 类型查找器 ITypeFinder
NopCommerce为了支持插件功能,以及支持一些自动注册的功能.系统提供了类型查找器.ITypeFinder以及实现类就是提供此功能.通过类型查找器可以查找本程序域中的类,也可以查找整个bin目录 ...
随机推荐
- Request、Request.Form和Request.QueryString的区别
Request.Form:获取以POST方式提交的数据(接收Form提交来的数据): Request.QueryString:获取地址栏参数(以GET方式提交的数据) Request:包含以上两种方式 ...
- C/C++:作用域、可见性与生存期
作用域 作用域是用来表示某个标识符在什么范围内有效. C++的作用域主要有四种:函数原型作用域.块作用域.类作用域和文件作用域. 由大到小:文件作用域>类作用域>块作用域>函数原型作 ...
- [转] Web前端优化之 Server篇
原文链接: http://lunax.info/archives/3093.html Web 前端优化最佳实践第二部分面向 Server .目前共计有 6 条实践规则.[注,这最多算技术笔记,查看最原 ...
- 虚拟桌面基础架构(VDI)与终端服务和传统PC对比
VDI(Virtual Desktop Infrastructure),即虚拟桌面基础架构,正迅速成为一个热门词汇,它将颠覆企业向终端用户交付应用的游戏规则.这篇专题就是想通过VDI与两种传统技术的对 ...
- 【sgu282】Isomorphism
题意: 给出n(n<=53)点的无向完全图 要将每条边染上m(m<=1000)种颜色的一种 只改变顶点编号的图视为同种方案 求本质不同方案数%p(p>n且为质树)的值 题解: 这题貌 ...
- post和put的区别
post : 标识的是处理请求中资源表述的资源 put : 标识的是请求的资源表述 post : 支持多种类型的资源 put : 支持单一的资源
- -exec 与 xargs 的区别
实地在shell里执行下如下命令就知道区别了: $ find -type f -exec echo {} \; 很明显,exec是对每个找到的文件执行一次命令.从这里可以看出exec的缺点是每处理一个 ...
- Lua学习笔记(二):基本语法
Lua学习指南:http://www.lua.org/manual/ 首先我们要明确的一点是:在Lua中,除了关键字外一切都是变量. Lua关键字 可以查看这个地址:http://www.lua.or ...
- python 循环
200 ? "200px" : this.width)!important;} --> 介绍 python中有两种循环,分别是for...in循环.while循环:for.. ...
- Http通讯协议在.net下的实现方法
1.HttpwebRequest and HttpWebResponse 2.客户端访问服务端的API:HttpClient 3. .net下的Remoting 4.Web Services 5.W ...