hello,
I was wondering if creating a custom Ipriciple is not going to hurt performance of my application. I was debugging my code and it seems that on every request my principle object is recreated. in other words i am having to access AD on eah request. can someone tell me if this is the right approach?
I was wondering if creating a custom Ipriciple is not going to hurt performance of my application. I was debugging my code and it seems that on every request my principle object is recreated. in other words i am having to access AD on eah request. can someone tell me if this is the right approach?
Code:
void Application_AuthenticateRequest(Object sender, EventArgs e)
{
if (Request.IsAuthenticated == true && this.User != null)
{
//Construct SecurityManager with AD path passed in from web config.
SOLARBusinessLayer.SecurityManager objSec = new SOLARBusinessLayer.SecurityManager();
objSec.ADPath = ConfigurationManager.ConnectionStrings["ADConnectionString"].ToString();
objSec.ADUserName = ConfigurationManager.AppSettings["USERNAME"].ToString();
objSec.ADPassword = ConfigurationManager.AppSettings["PWD"].ToString();
//Create a CustomPrincipal for the current user.
SOLARBusinessLayer.SolarPrincipal cprPrincipal = objSec.ConstructCustomPrincipal(this.User.Identity);
//Replace the GenericPrincipal in the HttpContext for the current request.
this.Context.User = cprPrincipal;
}
}