Impersonation fails when loading rom third party assembly

J

Jeroen van Onzen

Hi guys,

I posted this question first in the wrong newsgroup (.net.security), but
this is an asp.net question (i guess). Sorry ...


I am developing a web application. When I try to connect to an Analysis
Services 2005 server everything works fine. When I try to connect to an
Analysis Services by an assembly which i load an exception occurs.

There should be a blog or a newsgroup entry somewehere of this problem, but
i didn't find it. Sorry, but after discovering this bug (took a while) I
probably narrowed my focus too small.

When loading the assembly in a strandard .Net application everything works
fine.

How can I solve this problem?????

With regards,

Jeroen van Onzen

In Web.Config this line:
<authentication mode="Windows"/>
<identity impersonate="false"/>

protected void Page_Load(object sender, EventArgs e)
{
string currentUserNameDebug = WindowsIdentity.GetCurrent().Name; //returns
my ASP.Net account
WindowsImpersonationContext context =
((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate();
//impersonating
currentUserNameDebug = WindowsIdentity.GetCurrent().Name; //returns
my Windows account

// trying to setup a normal Adomdconnection
AdomdConnection connection = new AdomdConnection();
connection.ConnectionString = "Data Source=" + "wally" + ";"; //this is
another machine
connection.Open(); //connection opens, when tracing(using the Profiler) I
see a new connection
connection.Close();

//trying to setup a normal Adomdconnection by a third-party assembly
ThirdParty.Control.AnalysisServices.Report report = new
ThirdParty.Control.AnalysisServices.Report();
report.ConnectionString = "Data Source=" + "wally" + ";";
report.Connect(); //connection fails, profiler shows the NT Authority
Network Account
report.Disconnect();

context.Undo(); //undo impersonate
currentUserNameDebug = WindowsIdentity.GetCurrent().Name; //returns
correct name
}
 
M

Matthew Roebuck

Jeroen -

It is a little difficult to read your code but it appears that you have
impersonate set to false in your web.config file. When your code attempts to
instantiate the COM object, what type of exception is being thrown? I am
fairly certain that your code is attempting to instantiate the COM object
under the restricted access user ASP.NET code executes under normally and
probably doesn't have the required permissions. What happens when you set
impersonate attribute to true?

Good luck,
Matthew Roebuck
 
J

Jeroen van Onzen

Matthew,

thanks for your response. I finally discovered the problem, the third party
component is lauching a seperate thread. Thanks all for looking to my
problem.

Sorry

Jeroen
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top