User-131142063 posted
EDIT: Found the issue! In IIS7.5, in Authentication, I had to disable Anonymous Authentication and enable Windows Authentication. Success!
Hi there!
We have moved a website from IIS6 to IIS7.5 and it no longer seems to work. The specific part which fetches the user's AD alias doesn't seem to be firing any more, and this impacts on our welcome message and various other user-specific parts of the page.
I've chopped the script down and isolated the specific part of the script which isn't firing. Simply put, it works when served from IIS6 and when debugging in Visual Studio 2010.
The code is as follows:
<%@ Page Language="VB" %>
<!DOCTYPE html>
<script runat="server">
'Request one by name
Public strNTUser As String
Public iPos As Integer
Public Function GetServerVariable(ByVal VariableName As String) As String
Return Request.ServerVariables(VariableName)
End Function
'You may prefer to just focus on a few of interest
'by hard coding their names in a function such as below
Public Function ApplicationPath() As String
Return Request.ServerVariables("APPL_PHYSICAL_PATH")
End Function
Public Function LoggedOnUser() As String
Return Request.ServerVariables("LOGON_USER")
End Function
Public Function CurrentPage() As String
Return Request.ServerVariables("SCRIPT_NAME")
End Function
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strNTUser = RTrim(GetServerVariable("LOGON_USER"))
iPos = Len(strNTUser) - InStr(1, strNTUser, "\", 1)
strNTUser = Right(strNTUser, iPos)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<% Response.Write(strNTUser)%>
</div>
</form>
</body>
</html>
Is there any reason why IIS7.5 isn't able to pull through (or pass through?) the information from the script, back to the web page to be served?
I'm baffled. Your assistance is much appreciated. This is crossposted over at the asp.net forums (http://forums.asp.net/p/1942235/5533334.aspx) because I'm not sure where the problem lies.
Tom