编译器错误消息: CS0117: “Helper”并不包含“GetLocation”的定义
尘于烦事 2011-11-05 09:26:43 “/SMSBO”应用程序中的服务器错误。
--------------------------------------------------------------------------------
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误消息: CS0117: “Helper”并不包含“GetLocation”的定义
源错误:
行 56: model.Type = 0;
行 57: model.LoginIP = Helper.GetIp();
行 58: model.LoginLocation = Helper.GetLocation(model.LoginIP);
行 59: try
行 60: {
源文件: e:\WORKSPACE\SMSBO\login.aspx.cs 行: 58
login.aspx.cs:
LoginLog model = new LoginLog();
LoginLogBLL LoginBLL = new LoginLogBLL();
model.LoginTime = DateTime.Now;
model.SourcesID = GetSession.GetUserId();
model.LogName = GetSession.UserLoginName();
model.Type = 0;
model.LoginIP = Helper.GetIp();
model.LoginLocation = Helper.GetLocation(model.LoginIP);这里报错,但是Helper中定义了GetLocation(string ipAddress)的定义
try
{
LoginBLL.LoginLog(model);
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message);
throw new Exception();
}
Helper:
public static string GetLocation(string ipAddress)
{
string m_Location = "", m_IpAddress = "", m_Response = "";
m_IpAddress = ipAddress.Trim();
WebClient client = new WebClient();
client.Encoding = System.Text.Encoding.GetEncoding("utf8");
string url = "http://www.ip138.com/ips.asp";
string post = "ip=" + ipAddress + "&action=2";
client.Headers.Set("Content-Type", "application/x-www-form-urlencoded");
string response = client.UploadString(url, post);
m_Response = response;
string p = @"<li>参考数据二:(?<location>[^<>]+?)</li>";
Match match = Regex.Match(response, p);
m_Location = match.Groups["location"].Value.Trim();
return m_Location;
}
为什么会这样?