locked
VB Script behind page not pulling data when served from IIS7.5 (works in IIS6 and in Debug) RRS feed

  • Question

  • User-367814372 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 iis.net forums (http://forums.iis.net/p/1202933/2060129.aspx) because I'm not sure where the problem lies.

    Tom

    Friday, October 11, 2013 9:14 AM

Answers

  • User-417640953 posted

    EDIT: Found the issue! In IIS7.5, in Authentication, I had to disable Anonymous Authentication and enable Windows Authentication. Success!

    Hi Tquigley,

    I'm glad to hear you solved the issue by self.

    For this issue, I think it is due to the difference of security between IIS6 and IIS7.5.

    In my mind, the anonymous-authentication has no changes from IIS7 to IIS7.5.

    By default, the anonymous authentication identity in IIS 7.0 is the IUSR account. This account is a low privilege identity with minimal rights and privileges.

    Anonymous authentication allows any user to access any public content without providing a user name and password challenge to the client browser.

    Against this issue, I think we should learn some difference of security between IIS6 and IIS7 .

    http://www.cyberbrutus.com/differences-between-iis-6-iis-7/

     

    Thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2013 3:12 AM
  • User-367814372 posted

    More importantly:

    If your colleague has written a site and configured the IIS to work with it, they should document it. :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2013 4:35 AM

All replies

  • User-417640953 posted

    EDIT: Found the issue! In IIS7.5, in Authentication, I had to disable Anonymous Authentication and enable Windows Authentication. Success!

    Hi Tquigley,

    I'm glad to hear you solved the issue by self.

    For this issue, I think it is due to the difference of security between IIS6 and IIS7.5.

    In my mind, the anonymous-authentication has no changes from IIS7 to IIS7.5.

    By default, the anonymous authentication identity in IIS 7.0 is the IUSR account. This account is a low privilege identity with minimal rights and privileges.

    Anonymous authentication allows any user to access any public content without providing a user name and password challenge to the client browser.

    Against this issue, I think we should learn some difference of security between IIS6 and IIS7 .

    http://www.cyberbrutus.com/differences-between-iis-6-iis-7/

     

    Thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2013 3:12 AM
  • User-367814372 posted

    More importantly:

    If your colleague has written a site and configured the IIS to work with it, they should document it. :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2013 4:35 AM