Problem to get Windows Logon ID & read file at the same time

Discussion in 'ASP .Net Security' started by genzy, Sep 27, 2006.

  1. genzy

    genzy Guest

    I'm facing the below problem.

    With <deny users="?" />, the Windows Login ID is able to be obtained to
    fill up the Windows IDSID text field automatically, but reading the
    file info is failed.

    Without <deny users="?" />, the Windows Login ID is not able to be
    obtained, but reading the file info is successful.

    Is there any way to make both working at the same time?
    Thanks for advice.

    Windows Logon ID - To get its value
    CODE:
    private string GetLogonUserIdsid()
    {
    string logonUserId = "";
    string logonUser = Request.ServerVariables["LOGON_USER"];

    if (!logonUser.Equals(""))
    {
    // ASCII Table - http://www.lookuptables.com/
    // char '\' = 92
    char[] splitter = {(char) 92};
    string[] strTmp = logonUser.Split(splitter);
    logonUserId = strTmp[1];
    } // End if.

    return logonUserId;
    }

    File Access - To check a file existence
    CODE:
    if (File.Exists(dir+file)) {
    return true;
    }
    else {
    return true;
    }

    web.config
    CODE:
    <authorization>
    <!-- It will deny all unauthenticated or anonymous users. -->
    <deny users="?" />

    <!-- Allow all users -->
    <allow users="*" />

    <!-- Note -->
    <!-- <allow users="[comma separated list of users]"
    roles="[comma separated list of roles]"/>
    <deny users="[comma separated list of users]"
    roles="[comma separated list of roles]"/>
    -->
    </authorization>
     
    genzy, Sep 27, 2006
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.