Why does HttpContext.Current.User.Identity.Name return an invalid username when used in a web part?

On the Sharepoint webpage, I had a problem identifying a registered user!

The master page contains a regular ootb control that displays the username

<%@ Register TagPrefix="wssuc" TagName="Welcome" Src="~/_controltemplates/Welcome.ascx" %>
.....
.....
<wssuc:Welcome id="explitLogout" runat="server" />

This always displayed the correct registered user.

However, if I call

HttpContext.Current.User.Identity.Name

from the web part, then in 1 or 2% of cases I get the wrong name.

This gives me a page that will have the correct username at the top and the wrong one in the web part. Other methods for retrieving a name in the web part return the same invalid name. If the name verification web page is located on the same page several times, it is very rare that the second copy of the web part has the correct name or the third incorrect name!

Identifiers are stored in Active Directory, and users are authenticated against the ISA server, users are not in the same domain as the SharePoint infrastructure. The sharepoint farm is quite complex with ISA servers, four web interfaces, an application server, and finally a database server.

Has anyone done this before? or have any clue as to the direction I must take in order to investigate the problem!

IIS6 2003. Sharepoint SP2, .

: . - ""

Title                       Intranet (Collaboration Site) 
Display Name                  (BLANK)
Display Description     Optimized for collaboration sites where authoring, web part cusomization, and minor version are enabled. 
Perform ACL Check       Yes 
Enabled                 Yes 
Duration                180 
Check for Changes       Yes 
Vary by Custom Parameter      (BLANK)    
Vary by HTTP Header     Browser 
Vary by Query String Parameters     (BLANK)      
Vary by User Rights     Yes 
Cacheability            ServerAndPrivate 
Safe for Authenticated Use  Yes 
Allow writers to view cached content   (BLANK)        
+3
2

SharePoint . SPContext.Current.Web.CurrentUser.LoginName .

+1

Source: https://habr.com/ru/post/1723336/


All Articles