asmgx
asmgx

Reputation: 8014

ASP.net page Authorization based on Network User

I am building a web application for internal use this application will be deployed on the internet but only employees should be able to access it.

How to know what is the network user id that is accessing the web page? so I can authorize them to access one page and not the other.

Upvotes: 0

Views: 42

Answers (1)

Muhammad Aamir Iqbal
Muhammad Aamir Iqbal

Reputation: 76

Use the following in your Web.config file where authentication mode is set to Forms; replace that with the following lines:

<authentication mode="Windows">

</authentication>
<authorization>
  <deny users="*"/>
</authorization>

Use the following line in your aspx page (code behind) to get the user name

User.Identity.Name 

Upvotes: 2

Related Questions