Click here to Skip to main content
15,885,880 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionAsymmetric encryption in XML Pin
greatoceansoftware11-Sep-15 14:36
greatoceansoftware11-Sep-15 14:36 
Questionhow to add pdf file dynamically and download it through ancher tag in asp.net Pin
Pr@senJeeT4-Sep-15 20:23
Pr@senJeeT4-Sep-15 20:23 
AnswerRe: how to add pdf file dynamically and download it through ancher tag in asp.net Pin
Richard MacCutchan4-Sep-15 21:33
mveRichard MacCutchan4-Sep-15 21:33 
QuestionHow to pass multiple parameters in autocomplete script Pin
Robymon1-Sep-15 9:17
Robymon1-Sep-15 9:17 
AnswerRe: How to pass multiple parameters in autocomplete script Pin
Pete O'Hanlon1-Sep-15 10:10
mvePete O'Hanlon1-Sep-15 10:10 
QuestionADO.NET EntityData Model Project for Postgresql Database Pin
Member 1151867926-Aug-15 21:33
Member 1151867926-Aug-15 21:33 
AnswerRe: ADO.NET EntityData Model Project for Postgresql Database Pin
Richard MacCutchan26-Aug-15 22:04
mveRichard MacCutchan26-Aug-15 22:04 
Questionhigh concurrency,principalContext.ValidateCredentials,slow Pin
Member 1193909726-Aug-15 19:59
Member 1193909726-Aug-15 19:59 
Hi.

I run a ASP.NET web site.This web site need authentication people with Microsoft ActiveDirectory.Threr are more than 500 thousand user ,10 thousand OrganizationUnit on the Domain Controller.

I wrote a function to validate people in a static class:
C#
static public string ValidateCredentials(string userName, string password)
        {
            string result = null;
            try
            {
                log4net.ILog log = log4net.LogManager.GetLogger("Login.Aspx");
                DateTime time0 = DateTime.Now;
                PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, StsDomainName, StsAdRootOu + "," + StsDomainDn , ContextOptions.SimpleBind,StsAdUserName, StsAdUserPswd);
                
                
                if (principalContext.ValidateCredentials(StsDomainShrotName +"\\" + userName, password,ContextOptions.SimpleBind))
                    result = "1";
                else
                    result = "0";
                log.Debug("Time cost:" + (DateTime.Now - time0).TotalMilliseconds + "DC:" + principalContext.ConnectedServer);
                //principalContext.Dispose();
            }
            catch (Exception e)
            {
                result = e.Message;
            }
            
            return result;

During hign concurrency scence, more than 2000 user login the web site at the same time. I found it cost a long time to do the validation.

But if i dim the principalContext as a static member of the class,the time cost on validation will be cut down.But the CPU usage on the web site server will raise to 90%.

anyone can help me to improve my code
SuggestionRe: high concurrency,principalContext.ValidateCredentials,slow Pin
Richard MacCutchan26-Aug-15 22:03
mveRichard MacCutchan26-Aug-15 22:03 
QuestionUnable to Run 4.5 Framework Console Application exe via CMD prompt Pin
Kannan Mahes24-Aug-15 22:22
Kannan Mahes24-Aug-15 22:22 
AnswerRe: Unable to Run 4.5 Framework Console Application exe via CMD prompt Pin
Eddy Vluggen24-Aug-15 22:29
professionalEddy Vluggen24-Aug-15 22:29 
GeneralRe: Unable to Run 4.5 Framework Console Application exe via CMD prompt Pin
Kannan Mahes24-Aug-15 22:48
Kannan Mahes24-Aug-15 22:48 
GeneralRe: Unable to Run 4.5 Framework Console Application exe via CMD prompt Pin
Eddy Vluggen24-Aug-15 23:14
professionalEddy Vluggen24-Aug-15 23:14 
GeneralRe: Unable to Run 4.5 Framework Console Application exe via CMD prompt Pin
Richard MacCutchan25-Aug-15 3:24
mveRichard MacCutchan25-Aug-15 3:24 
GeneralRe: Unable to Run 4.5 Framework Console Application exe via CMD prompt Pin
phil.o30-Sep-15 3:56
professionalphil.o30-Sep-15 3:56 
QuestionCan we run and execute this code in visual studio Pin
Ashfaque Choudhary24-Aug-15 20:43
Ashfaque Choudhary24-Aug-15 20:43 
QuestionRe: Can we run and execute this code in visual studio Pin
Richard MacCutchan24-Aug-15 21:32
mveRichard MacCutchan24-Aug-15 21:32 
AnswerRe: Can we run and execute this code in visual studio Pin
OriginalGriff24-Aug-15 21:37
mveOriginalGriff24-Aug-15 21:37 
QuestionUnable to do changes in MVC Pin
Member 1192902223-Aug-15 2:35
Member 1192902223-Aug-15 2:35 
AnswerRe: Unable to do changes in MVC Pin
Dave Kreskowiak23-Aug-15 6:58
mveDave Kreskowiak23-Aug-15 6:58 
AnswerRe: Unable to do changes in MVC Pin
Member 1079196620-Sep-15 21:39
Member 1079196620-Sep-15 21:39 
QuestionInstance Issues while executing R.Net code Pin
Member 1192526520-Aug-15 23:22
Member 1192526520-Aug-15 23:22 
SuggestionRe: Instance Issues while executing R.Net code Pin
Richard MacCutchan21-Aug-15 0:10
mveRichard MacCutchan21-Aug-15 0:10 
AnswerRe: Instance Issues while executing R.Net code Pin
Member 1079196620-Sep-15 21:44
Member 1079196620-Sep-15 21:44 
QuestionIntranet Web Application Pin
aswini19-Aug-15 22:43
aswini19-Aug-15 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.