Impersonation fails when loading rom third party assembly

Discussion in 'ASP .Net Security' started by Jeroen van Onzen, Jul 13, 2006.

  1. 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
    }
    Jeroen van Onzen, Jul 13, 2006
    #1
    1. Advertising

  2. 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
    Matthew Roebuck, Jul 14, 2006
    #2
    1. Advertising

  3. 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



    "Matthew Roebuck" wrote:

    > 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
    Jeroen van Onzen, Jul 14, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kieran Benton
    Replies:
    3
    Views:
    497
    Ray Cassick \(home\)
    Sep 11, 2003
  2. Billy Porter
    Replies:
    0
    Views:
    1,004
    Billy Porter
    Jun 25, 2003
  3. Mikael Engdahl

    Strange error when calling third party assembly

    Mikael Engdahl, Aug 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    357
    Mikael Engdahl
    Aug 8, 2003
  4. Cowboy \(Gregory A. Beamer\)

    Re: Use Third Party HTML Designer

    Cowboy \(Gregory A. Beamer\), Nov 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    357
    Marty Cruise
    Nov 5, 2003
  5. hangeonos
    Replies:
    0
    Views:
    750
    hangeonos
    May 24, 2009
Loading...

Share This Page