HrvojeVd, I was able to duplicate the null user error you are experiencing. here is my scenario:
windows authentication in web.config and IIS
impersonating user
I have a timer event that begins at application start. within this event I call the database
this is where the problem exists. impersonation applies to the HTTP context. But the timer doesn't run on an HTTP request. therefore I cannot use the user account to log into the database. The timer is running independent of any user account.
the same is true with other points in the asp.net pipeline: starting session, application start, application end (and there may be more). If you are trying to connect to the database at any one of these points you will get the null user error.
I hope this sheds some light on your issue.
Jason Meckley
Programmer
Specialty Bakers, Inc.
faq855-7190
faq732-7259