windows authentication and mssql server

T

Tjoep

Hi,

I've got this asp project, Authentication mode is set to Windows and the
identity impersonate is enabled.
Is there any way to find out what user is logged in? I was thinking about
something like the User.Identity object. But when i check the User.Identity,
it is logged-in as an annonymous user (spelling?)

The main thing I want to do with my project is the following:
a user opens the page and authenticates with his windows password, then he
is shown all his projects. That is, the projects he is allowed to see. All
the data of the projects are stored in an mssql database.We connect to the
database with a connectionstring that states "Trusted_Connection=true".

But somehow al the users see every project from the database.
Any help is appreciated.


best regards,
Bart
 
P

Paul Clement

¤ Hi,
¤
¤ I've got this asp project, Authentication mode is set to Windows and the
¤ identity impersonate is enabled.
¤ Is there any way to find out what user is logged in? I was thinking about
¤ something like the User.Identity object. But when i check the User.Identity,
¤ it is logged-in as an annonymous user (spelling?)
¤
¤ The main thing I want to do with my project is the following:
¤ a user opens the page and authenticates with his windows password, then he
¤ is shown all his projects. That is, the projects he is allowed to see. All
¤ the data of the projects are stored in an mssql database.We connect to the
¤ database with a connectionstring that states "Trusted_Connection=true".
¤
¤ But somehow al the users see every project from the database.
¤ Any help is appreciated.

Did you configure the web application (in IIS) for either Basic or Integrated Windows
authentication?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
S

swat

If you have Anonymous enabled in IIS and impersonation enabled in the
config file, WindowsIdentity.GetCurrent().Name will return
IUSR_<machinename> and User.Identity.Name will be an empty string.

What you want is to get both User.Identity.Name and
WindowsIdentity.GetCurrent().Name returning the currently logged on
user. To do this, you need to disable Anonymous in IIS (and only enable
Windows Integrated) and enable impersonation in the config file.

HTH.
 
T

Tjoep

Hi all,

I found my mistake, the anonymous acces was indead enabled.
Thanks for all your quick responses. seems to me, I can now succesfully read
the identity.

Bart
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top