I am using a method that successfully impersonates another windows user but 
when I connect to the database nhibernate reverts me to the windows user.  Due 
to restrains in the organization I am forced to use the permissions of a 
windows user.

 

My code:

#region Properties

private ISessionFactory factory = null;

private ISession _session = null;

#endregion

 

 

public Repository()

{

Console.Write(WindowsIdentity.GetCurrent().Name); // successfully impersonated 
corp\userAdmin

Configuration cfg = new Configuration();

cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, conStr); 
//Integrated Security=SSPI

cfg.Configure();

factory = cfg.BuildSessionFactory(); // throws exception complaining corp\user1 
cannot login

_session = factory.OpenSession();

}

 

Impersonator code:

http://snipplr.com/view/19323/impersonator/

 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to