Groups | Blog | Home
all groups > dotnet interop > november 2005 >

dotnet interop : Accessing Unmanaged code from ASP.net


admiller97 NO[at]SPAM gmail.com
11/2/2005 2:31:38 PM
I've got some code to access an unmanaged dll, and it works fine in a
windows based app, but when I move the code to a web application it
does not work. It does not throw an error, it acts like the code never
gets called.

private class dllWrap
{
[DllImport("C:\\ProcessCommand.dll")]
public static extern void ProcessCommand(IntPtr str);
}
private void SendCmd(string command)
{
IntPtr str = Marshal.StringToHGlobalAnsi(command);
dllWrap.ProcessCommand(str);
}
protected void Button1_Click(object sender, EventArgs e)
{
this.SendCmd("WORKED");
}
Vadym Stetsyak
11/3/2005 12:00:00 AM
in the web application context you may have no access to
C:\ProcessCommand.dll

Try to put this dll into the same folder where .net assembly you're
p/invoking from is located.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com


[quoted text, click to view]

AddThis Social Bookmark Button