I am new to ASP.net and am learning and writing a web site application in VS 2010 that will eventually become our company's intranet web site. As part of the start page, I want to display the user's name in a welcome message like: "Welcome: E Young".
The company's intranet is being hosted on a new, virtual file server that is running Windows 2008 R2. I installed IIS 7.5 and have attempted to configure it but I am new to IIS 7.5 also. The users will access the company's intranet via IE 8 using the url for our intranet site. I am developing the ASP.net web site using VS 2010 on my development computer then transferring the files from my computer to the new intranet computer's C:\Inetpub\wwwroot\ folder.
That all seems to be working fine except for the Welcome message. When I start IE 8 on my development computer or the intranet server and type in the web site url, I do see the starting page that I have developed but the Welcome message does not show the user's name. It just shows "Welcome:". However, when I run the web site from my development computer from within VS 2010, I do see the welcome message, i.e. "Welcome: E Young" correctly.
IE 8 does have windows authentication enabled as does IIS 7.5 yet the web site is not able to pickup the user's windows login name and display it.
Below is the code from the Default.aspx.vb file along with the Default.aspx file showing the displaying of the Welcome message.
This question was previously posted but although many things were tried, no answer was found. Here is the previous question:
Thank you for the help.
Here is the Default.aspx.vb code:
Partial Class _Default
Public mUserName As String
Public mWelcomeMessage As String
Public mInt As Integer
Public mUser_Initial As String
Public mUser_Last_Name As String
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'mUserName = UserPrincipal.Current.DisplayName
mUserName = Trim(System.Web.HttpContext.Current.User.Identity.Name)
If mUserName > "" Then
mInt = InStr(mUserName, "\")
If mInt > 0 Then
mUserName = Mid(mUserName, mInt + 1, Len(mUserName) - (mInt))
mUser_Initial = UCase(Left(mUserName, 1))
mUser_Last_Name = UCase(Mid(mUserName, 2, 1)) & Mid(mUserName, 3, Len(mUserName) - 2)
mWelcomeMessage = "Welcome: " & mUser_Initial & " " & mUser_Last_Name
mWelcomeMessage = "Welcome: " & mUserName
mWelcomeMessage = ""
If Err.Number <> 0 Then
mUserName = ""
Here is the Default.aspx code showing the displaying of the mWelcomeMessage on the ASP page:
<div style="position:absolute; top:115px; left:825px; z-index: 1; visibility:visible; height: 20px; width: 300px; text-align:right;">