server.createobject differences between c# and vb.net

Q

quintesv

hi all,

Running VS.2003 , framework 1.1.

I have a COM object written in Delphi which im trying to call through ASP.NET.


The COM object connects to a folder on another machine and opens a connection
to a foxpro database in that folder. I have a problem with even accessing
that path through SYSTEM.IO.File.EXists and Peter Bromberg suggested
impersonation via LOGONUSER. I have implemented LOGONUSER and now I can
access the file via SYSTEM.IO.File but the problem now is that the COM Object
cannot access that path. I thought it might be impersonation and have left
that implemented but have tried

1. setting <impersonate = "true" in web config
2. setting user name and password to a domain user in machine.config.


I tried creating the object in C# through the following methods

//CODE begin

object o = new object();

o = Server.CreateObject("CQSBackOffice.BOLHandler");
CQSBackOffice.BOLHandlerClass bb = (CQSBackOffice.BOLHandlerClass) System.
Runtime.InteropServices.Marshal.CreateWrapperOfType(o,
typeof(CQSBackOffice.BOLHandlerClass));
//o.Connect("","","");
bb.UserName = "sup";
bb.Password = "";
bb.Connect("CWT","data",@"\\servername\Client Data\");

string sqq = bb.ReasonText;


Type tServerType = Type.GetTypeFromProgID("CQSBackOffice.BOLHandler");
CQSBackOffice.BOLHandlerClass b = (CQSBackOffice.BOLHandlerClass)
Activator.CreateInstance(tServerType);

b.UserName = "sup";
b.Password = "";
b.Connect("CWT","data",@"\\servername\Client Data\");

string s = b.ReasonText;

// Create a remote WMSServer object from a System.Type object and
// the CreateObject method.

Type tServerType2 = Type.GetTypeFromProgID("CQSBackOffice.BOLHandler");
CQSBackOffice.BOLHandlerClass b2 = (CQSBackOffice.BOLHandlerClass)Server.
CreateObject(tServerType2);


b2.UserName = "sup";
b2.Password = "";
b2.Connect("CWT","data",@"\\servername\Client Data\");

string s2 = b2.ReasonText;

// // Create a remote WMSServer object from a System.Type object and a
// // System.Activator object.
Type tServerType3 = Type.GetTypeFromProgID("CQSBackOffice.BOLHandler");
CQSBackOffice.BOLHandlerClass b3 = (CQSBackOffice.BOLHandlerClass)
Activator.CreateInstance(tServerType3);


b3.UserName = "sup";
b3.Password = "";
b3.Connect("CWT","data",@"\\servername\Client Data\");

string s3 = b3.ReasonText;

//CODE End



The .Reason text always returns "access denied" or file related errors.

Now for the killer..

When running Server.Createobject in VB.NET the code works

So basically,

//pseudo Code begin (VB.NET)

Object x = Server.CreateObject("Object.Class")

x.UserName = "sup";
x.Password = "";
x.Connect("CWT","data",@"\\servername\Client Data\");



//Code end

The code above works...

I'm looking kinda stupid now because I can't get this to work in C#...

So what is the problem here? Is it that VB.NET does the Wrapper and Binding
in such a way that results in some level of impersonation being passed
through in the Wrapper?

Or is this a VS.2003 bug?

Thanks for any assistance,

Q
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top