Web Test and Username / Password

Hello

I have created a web site with Windows Authentication, allowing one specific user to have access to it, and all the other one are denied. So in web.config:
        <authentication mode="Windows" />
        <authorization>
            <allow users="domain\username"/>
            <deny users="*"/>
            <deny users=" "/>
        </authorization>

I wanted to do some testing in my web site and I wanted to do a check with an authorized user, and then a check with an unauthorized user. So I was thinking to record a web test and specifying the username and password in the WebTest.
But apparently this is not working. Even when I specify a user that is authorized in the site (the one specifided in the config file) I get back a "Forbidden" error at the WebTest execution if this user is not the one connected to Windows.

Any idea
(for info, I still use VS2005 Team Suite Beta 2)



Answer this question

Web Test and Username / Password

  • TheVenkster

    Yes

  • Milinda V

    I tried this out with the rtm build against a cassini web site and it worked as you expected.  My web.config file has

    <authorization>
       <
    allow users="domain\test1"/>
       <
    deny users="*"/>
       <
    deny users=" "/>
    </
    authorization>

    I was logged onto the machine as domain\test1. 

    In the web test, I set the username to domain\test1 and the password to the password for the test1 user.  I played the test back and it was successful as expected. 

    Then I changed the user name to domain\test2 and the password to the password for test2.  When I played back the test, the test failed with a 401 Unauthorized status code.

    Next I changed the web.config to
    <authorization>
       <
    allow users="domain\test2"/>
       <
    deny users="*"/>
       <
    deny users=" "/>
    </
    authorization>
    I stayed logged on to VS as test1 and changed the web test back to simulating domain\test1.  This time the web test failed with 401 as expected.  Next I changed the webtest to simulate domain\test2 and the test passed.

    Is this what you are doing   Are you setting the domain in the username field as well

    I would strongly suggest updating to a more recent build.  There have been many many fixes since the beta.



  • A Noble

    Ok thanks for your answer
    I am currently downloading the Team Suite Trail Edition and I will upgrade this afternoon. I will keep you informed if this works with the new version !

  • ProfHawking

    How are you specifying the username/password on the web test   Is it by clicking on the root node of web test and setting the properties in the property browser

  • TopOracle

    Interesting thing :
    I'm connected on Windows as User1
    I run VS.NET as User1
    In my Web Test, I specify Username = User1
    --> It works

    In my webTest, I specify username = User 2 (allowed in the web.config)
    --> HTTP Status : Forbidden

    I'm connected on Windows as User1
    I run VS.NET on behalf of User2
    In my Web test, I specify username = User2
    --> It works

    In my webTest, I specify username = User 1 (allowed in the web.config)
    --> HTTP Status : Forbidden


    It sounds as if Cassini is blocking something. Can it be possible
    Can I configure Cassini to allow several user connected to it


  • Web Test and Username / Password