ASP.NET allow access to all domain users without over-riding Environment.UserName

102 views Asked by At
  • I have a vb.Net app which has been running fine locally using localhost and 'Integrated Security=True' in my connection string.
  • The application itself uses Environment.UserName to allow access to the webpages and present different info depending on the user name I get back.

The site is now on the production server (which is still within our network) and I get 'Login failed for user 'DOMAIN\SERVERNAME'.

I need away of allowing access to all company users and don't want to specify a user name and password in my connection string as when I do that it prevents me accessing the individual user using 'Environment.UserName' Not sure about the semantics of calling this an intranet application but I think that the area I am involved in.. Certainly the site will not be available outside the company.

I think this question needs more info but not quite sure what else to say! Will keep a close eye on any responses.

1

There are 1 answers

1
Patrick Hofman On

Environment.UserName gets you the current logged in user on the server operating system, and in ASP.NET that is the user name of the Application Pool.

In ASP.NET you should use HttpContext.Current.Session.User if you want the name of the user connecting to your website.