我有一个DLL >> System.Data.SQLite.dll
要以正常方式使用它>只需将其添加为参考和
using System.Data.SQLite;
Run Code Online (Sandbox Code Playgroud)
然后,我可以使用此DLL中的所有函数.
但是,我想将我的app.exe和这个DLL 合并为一个文件.我尝试过使用ILmerge,但是失败了.据我所知,ILmerge无法合并unmanage DLL.
所以,我尝试了另一种方法>将DLL作为嵌入资源.我可以使用以下代码将其作为程序集加载:
Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream("MyApp.System.Data.SQLite.dll");
byte[] ba = null;
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = stm.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
ba = ms.ToArray();
}
Assembly sSQLiteDLL = Assembly.Load(ba);
Run Code Online (Sandbox Code Playgroud)
但是,我将如何使用SQLiteDLL中的函数?
我也尝试在属性中添加DLL作为资源并加载它像这样:
public Form1()
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
InitializeComponent();
}
System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{ …Run Code Online (Sandbox Code Playgroud) 如何获取上一页网址?
senario,用户可能来自google,yahoo,bing.
怎么知道他们来自哪里?
我尝试使用Request.UrlReferrer
但它返回一个空值.
谢谢你的建议.
我正在使用ASP.NET webform,C#.
更新
我有一个网站运行.
我只是想知道当用户访问我的网站时他们来自哪里.