c# - 在 C# 中将经典的 asp 代码转换为 asp.net 代码
问题描述
嗨,我目前正在从事 asp.net webform 项目,我想使用从经典 asp 中解密密码的 dll 并在我的新项目中使用,我只有 dll。我无法将它所说的 dll 添加到引用中A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component.
Dll name: SamUtils.dll
这是经典asp上的代码
set Cipher = server.createobject("SamUtils.Cipher")
Cipher.KeyString = Session("UserName")
Cipher.MainText = RSPassword("Password")
Cipher.Decrypt
OldPassword = Cipher.MainText
set cipher = nothing
这就是我开始的,但我不知道如何继续或我在正确的道路上
[DllImport(@"C:\Users\nx011116\Documents\projects\WebApps\WebApps\bin\SamUtils.dll", CharSet = CharSet.Unicode)]
public static extern void Cipher();
更新代码
using System.Runtime.InteropServices;
// Use DllImport to import the Cipher function.
[DllImport("SamUtils.dll")]
public static extern string SamUtilsCipher(string username, string password)
{
//-- i dont know whats next
}
对不起,我是新手,希望有人帮我解决这个问题
解决方案
推荐阅读
- windows - 将exe的路径设置为批处理脚本中的变量
- django - 如何将上传图像字段添加到 Wagtail?
- regex - 正则表达式 n 在字符串中任意位置出现的字母
- node.js - 无法使用 Vue CLI 3 要求“fs”
- c++ - ROS RVIZ:如何可视化没有固定帧变换的点云
- c - 小型C电子表格程序骨架问题
- javascript - Jest 和 SCSS 变量
- java - 使用 beans.xml 为许多实现连接存储库
- django - 在 travis 构建中选择正确的 postgresql 版本
- c++ - boost.asio async_receive 永远不会解决