0

Hi i have this dll from an old project that the dll is uses to login but uppon adding the DLL on reference it give's me 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. here's the old code using the Dll its written in 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

so oppon researching i found that i can use DLL import in order to import.

Here's what i tryed

[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
          {

          }
        }

but i get

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)

i also try this [DllImport(@"C:\**\****\Documents\projects\WebApps\WebApps\bin\AppUser.User", CharSet = CharSet.Unicode)] but get

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)

Can i use that old dll in my new project because the dencryption of password on login is on that dll and that dll is only what we have to use in log in.

4
  • Does this answer your question? Asp.Net C# DllImport problem Commented Apr 20, 2020 at 2:34
  • Can you clear us about your problem? or what you need to know? Commented Apr 20, 2020 at 4:39
  • converting the first code from classic asp to asp.net Commented Apr 20, 2020 at 4:42
  • AspCompat="true" allows you to use COM objects in an aspx page. You might find it much quicker to rewrite your code as VB.net though, it would allow you to make minimal changes to your VBScript. dotnetfunda.com/interviews/show/179/… Commented Apr 20, 2020 at 22:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.