Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display the username in the welcome page

Status
Not open for further replies.

Menara

Programmer
Dec 18, 2002
8
DE
hi all
can someone show me how to display the username in the welcome page, i found this in many portals they write "welcome: 'the person who is authentified'".
how can i have the names from the NT counts?
 
Hi,
I found a web part that you can include on the home page of SPS, I've made a couple of changes to it, so it will only show the users name and increased the font a little.

Below is the exported web part code, just copy and paste into a new text file and save it as a .dwp and then import it into your portal.


<?xml version=&quot;1.0&quot;?>
<WebPart xmlns=&quot;urn:schemas-microsoft-com:webpart:&quot;>
<Title>User Details</Title>
<Description>Displays Users Name and IP Address using in built in Server Vars</Description>
<Content>'Generic Web Part Function. REQUIRED.
Function GetContent(nod)

' Displays user details and IP address
' pinched from MS Extranet sample
Dim UserName ' var for Username
Dim IPAddress ' var for remote_address
Dim strHTMLRet ' Output string
Dim BrowserVersion
Dim UserNameRep

Dim FullName

On Error Resume Next

'get username - note this bit of code required because if anonymous then blank string
UserName = request.servervariables(&quot;Logon_User&quot;)
if Len(UserName) = 0 then
UserName = &quot;Anonymous&quot;
end if

UsernameRep=Replace(ucase(UserName) , &quot;\&quot;, &quot;/&quot;)
set adsUser = getObject(&quot;WinNT://&quot; & UserNameRep)
FullName = adsUser.FullName


' get ip
IPAddress = request.servervariables(&quot;REMOTE_ADDR&quot;)
' get browser
BrowserVersion = request.servervariables(&quot;HTTP_USER_AGENT&quot;)

' Build up output string
strHTMLret = &quot;<DIV style=&quot;&quot;font-size: 150%&quot;&quot;>&quot;
strHTMLRet =strHTMLret & &quot;Welcome: &quot; & FullName &&quot;</div>&quot;
'Return string to Dashboard
GetContent = strHtmlRet

End Function</Content>
<ContentLink></ContentLink>
<XSL></XSL>
<XSLLink></XSLLink>
<MasterPartLink></MasterPartLink>
<RequiresIsolation>0</RequiresIsolation>
<ContentType>1</ContentType>
<IsIncluded>1</IsIncluded>
<AllowRemove>1</AllowRemove>
<IsVisible>1</IsVisible>
<FrameState>0</FrameState>
<AllowMinimize>1</AllowMinimize>
<HasFrame>0</HasFrame>
<Zone>4</Zone>
<PartOrder>0</PartOrder>
<PartImageSmall></PartImageSmall>
<PartImageLarge></PartImageLarge>
<CustomizationLink></CustomizationLink>
<CacheBehavior>0</CacheBehavior>
<CacheTimeout>0</CacheTimeout>
<PartStorage></PartStorage>
<Namespace></Namespace>
<Height></Height>
<Width></Width>
<DetailLink></DetailLink>
<HelpLink></HelpLink>
</WebPart>


Hope this helps

Steve.
 
hi
i used the code you sent me but when i tried to import the file .dwp it gives me this error:
DDSC.ImportDDSC.Import(varDashboardID);window.location.href=window.location.href
i tried also to put the content of the file as the content of the web part but it generate too much errors.
can you help me to solve this problem?
thank you
 
Hi,

Don't know whats going on there, send me you e-mail address and I'll send you a straight exported webpart which works fine on my site.

steve.reynolds@geest.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top