преобразование старого asp кода в asp. net веб-форму - PullRequest
0 голосов
/ 20 апреля 2020

Привет, у меня есть эта dll из старого проекта, которую dll использует для входа в систему, но uppon добавление DLL по ссылке дает мне a reference "AppUser.dll" can't be added, Please make sure that the file is accessible and that it is a valid assembly or COM component. вот старый код, использующий Dll, написанный в asp

'/ Create AppUser Object
    set MyUser =Server.CreateObject("AppUser.User") 
    MyUser.UserName=Request.Form("UserName")            'set this first - CANNOT BE OMITTED
    Response.Write(MyUser)


if MyUser.Login("WebApps","AppUsers",Request.Form("UserName"),Request.Form("Password"))=false then

    Session("NumAttempts") = Session("NumAttempts") + 1
        if Application("NumAttempts") = 0 then

так что оппоненты исследуют, я обнаружил, что я могу использовать импорт DLL для импорта.

Вот что я попробовал

[DllImport("AppUser.User", CharSet = CharSet.Unicode)]
        public static extern bool Login(string webapps, String appuser, String username,string password);
        protected void Page_Load(object sender, EventArgs e)
        {

        }



        protected void btnLogin_ServerClick1(object sender, EventArgs e)
        {
            Session["UserName"] = txtUser.Value;
          bool iscorrect = Login("WebApps", "AppUsers", txtUser.Value, txtpassword.Value);
          if (iscorrect == true)
          {
              Response.Redirect("Home.aspx");
          }
          else
          {

          }
        }

, но я получаю

An exception of type 'System.DllNotFoundException' occurred in WebApps.dll but was not handled in user code

Additional information: Unable to load DLL 'AppUser.User': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Я также пробую это [DllImport(@"C:\**\****\Documents\projects\WebApps\WebApps\bin\AppUser.User", CharSet = CharSet.Unicode)], но получаю

An exception of type 'System.DllNotFoundException' occurred in WebApps.dll but was not handled in user code

Additional information: Unable to load DLL 'C:\Users\nx011116\Documents\projects\WebApps\WebApps\bin\AppUser.User': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Могу ли я использовать эту старую DLL в моем новом проекте, потому что на этой DLL есть шифрование пароля при входе в систему, и эта DLL - только то, что мы должны использовать в логине.

...