Calling LogonUser with account that has autogenerated password

The MSFT doc states out of the box that aspnet_wp runs under the
installed account ASPNET. However this account has an autogenerated
password. I assuming they are using the LogonUser function to get a
handle to the this user, and from here do something like

If these assumptions are correct how are they logging in under this
account if they don't know the password? My thinking maybe way off.

I was trying to write some test code that required to be running under
ASPNET and I did not want to do this inside an page (using a
testing framework).