Click here to Skip to main content
15,888,461 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionLoad data from Database into Razor View using Checkbox Checked event Pin
Enobong Adahada29-Aug-15 3:50
Enobong Adahada29-Aug-15 3:50 
AnswerRe: Load data from Database into Razor View using Checkbox Checked event Pin
jkirkerx29-Aug-15 9:11
professionaljkirkerx29-Aug-15 9:11 
QuestionHow can write Algorithm for the following question? Pin
BUNER28-Aug-15 7:56
BUNER28-Aug-15 7:56 
AnswerRe: How can write Algorithm for the following question? Pin
Richard Deeming28-Aug-15 8:16
mveRichard Deeming28-Aug-15 8:16 
GeneralRe: How can write Algorithm for the following question? Pin
BUNER28-Aug-15 8:25
BUNER28-Aug-15 8:25 
QuestionCapturing Selected Items in a DataList Control Pin
Member 1005957127-Aug-15 0:40
Member 1005957127-Aug-15 0:40 
AnswerRe: Capturing Selected Items in a DataList Control Pin
jkirkerx28-Aug-15 9:36
professionaljkirkerx28-Aug-15 9:36 
Questionhigh concurrency,principalContext.ValidateCredentials,slow Pin
Member 1193909726-Aug-15 22:05
Member 1193909726-Aug-15 22:05 
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:
Hide Copy Code
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
Questionpartial view and model binding Pin
rajeshmoorthy24-Aug-15 18:51
rajeshmoorthy24-Aug-15 18:51 
QuestionPDF.JS using ASP.NET MVC Pin
Kandepu Rajesh24-Aug-15 11:54
Kandepu Rajesh24-Aug-15 11:54 
AnswerRe: PDF.JS using ASP.NET MVC Pin
Richard Deeming25-Aug-15 2:27
mveRichard Deeming25-Aug-15 2:27 
GeneralRe: PDF.JS using ASP.NET MVC Pin
Kandepu Rajesh25-Aug-15 10:21
Kandepu Rajesh25-Aug-15 10:21 
GeneralRe: PDF.JS using ASP.NET MVC Pin
Richard Deeming26-Aug-15 1:57
mveRichard Deeming26-Aug-15 1:57 
AnswerRe: PDF.JS using ASP.NET MVC Pin
sigma_ivan25-Aug-15 19:02
sigma_ivan25-Aug-15 19:02 
Questionmultiple database connection. how to rollback Pin
Karan_TN24-Aug-15 1:23
Karan_TN24-Aug-15 1:23 
AnswerRe: multiple database connection. how to rollback Pin
F-ES Sitecore24-Aug-15 2:10
professionalF-ES Sitecore24-Aug-15 2:10 
Questionitem template of data list use anchor href that change by dynamicallyon user click after that fetch data by href Pin
Member 1005957118-Aug-15 16:31
Member 1005957118-Aug-15 16:31 
AnswerRe: item template of data list use anchor href that change by dynamicallyon user click after that fetch data by href Pin
Richard MacCutchan19-Aug-15 20:59
mveRichard MacCutchan19-Aug-15 20:59 
AnswerRe: item template of data list use anchor href that change by dynamicallyon user click after that fetch data by href Pin
Otekpo Emmanuel23-Aug-15 11:29
Otekpo Emmanuel23-Aug-15 11:29 
Questionid change data list item data bound with data list Pin
Member 1005957118-Aug-15 9:08
Member 1005957118-Aug-15 9:08 
AnswerRe: id change data list item data bound with data list Pin
jkirkerx19-Aug-15 9:19
professionaljkirkerx19-Aug-15 9:19 
GeneralRe: id change data list item data bound with data list Pin
Member 1005957119-Aug-15 9:39
Member 1005957119-Aug-15 9:39 
QuestionDeploy mvc application on ftp Pin
DPaul199417-Aug-15 7:50
DPaul199417-Aug-15 7:50 
AnswerRe: Deploy mvc application on ftp Pin
Afzaal Ahmad Zeeshan17-Aug-15 23:16
professionalAfzaal Ahmad Zeeshan17-Aug-15 23:16 
GeneralRe: Deploy mvc application on ftp Pin
DPaul199418-Aug-15 9:37
DPaul199418-Aug-15 9:37 

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.