文件Mexico.Data.dll在/ bin /,其他页面引用它没有错误,我的问题是什么?
CODE:
<%@ WebHandler Language="C#" Class="AuthCheck" %>
using System;
using System.Web;
using Mexcio.Data;
public class AuthCheck : IHttpHandler {
public void ProcessRequest (HttpContext context) {
ODA.Users findMatch = new ODA.Users();
findMatch.loadByUserName(context.Request.QueryString["uname"],"=","");
string getPass = decrypt(findMatch[0].Password);
if ((FormsAuthentication.HashPasswordForStoringInConfigFile(getPass, System.Web.Configuration.FormsAuthPasswordFormat.SHA1)) == (context.Request.QueryString["pass"]))
{
context.Response.Write("OK");
}
}
public bool IsReusable {
get {
return false;
}
}
}
ERROR:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'Mexcio' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 3: using System;
Line 4: using System.Web;
Line 5: using Mexcio.Data;
Line 6:
Line 7: public class AuthCheck : IHttpHandler {
Source File: c:\Inetpub\wwwroot\devv\services\AuthCheck.ashx Line: 5
答案 0 :(得分:2)
using语句有一个拼写错误:使用 Mexcio .Data;应该使用墨西哥 .Data;
答案 1 :(得分:2)
我遇到了同样的问题,但这不是一个简单的错字。以下是我解决它的方法:
Mexico.Data
是一个自定义的命名空间,也应该在GAC中。将以下字符串添加到ashx文件的顶部。
<%@ Assembly Name="Mexico.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234567890" %>
更改PublicKeyToken
和Version
以匹配,您应该可以在您的ashx中使用Mexico.Data
(或您自己的dll)。