因此,我有一个基本的LAMP服务器,我使用它来运行我的asp.net网站(运行单声道)。当用户访问我的网站时,我会将他们的所有信息记录在我的数据库中。
当从代码测试应用程序时,它的工作方式就像一个护身符。但是,如果我将我的网站发布到我的服务器并访问该网站,它不会记录任何内容。
我的桌面运行Win7,服务器是带Apache2的64位Ubuntu.我的第一个想法是也许我做得不对。所以,我从这里运行http://msdn.microsoft.com/en-us/library/3yekbd5b.aspx的代码,所有的东西都是假的。我认为问题不一定是我的代码造成的,而可能是apache2造成的。
根据您所看到的,我在这方面做了一些代码。
public string GetBrowserType()
{
var value = String.Empty;
if (HttpContext.Current.Request.Browser.Type != null && HttpContext.Current.Request.Browser.Type != "*0")
{
value = bc.Type;
}
return value;
}
public string GetBrowserName()
{
var value = String.Empty;
if (HttpContext.Current.Request.Browser.Browser != null && HttpContext.Current.Request.Browser.Browser != "*")
{
value = bc.Browser;
}
return value;
}
public string GetOs()
{
var value = String.Empty;
if (HttpContext.Current.Request.Browser.Platform != null && HttpContext.Current.Request.Browser.Platform != "unknown")
{
value = bc.Platform;
//value = HttpContext.Current.Request.Browser.Platform;
}
return value;
}那么问题会出在Apache上吗?是否有需要启用的mod才能允许它记录所有内容?
发布于 2012-01-08 19:24:41
您可能尚未在asp.net运行池中更新/安装浏览器检测文件。
要使Request.Browser正常工作,您必须在\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers\上配置文件
https://stackoverflow.com/questions/8773320
复制相似问题