Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
On my website i want to authenticate user based on there windows login id . Please tell me how do you access persons windows login id in asp.net .i want to provide access to my website to restricted persons based on there windows login id
Posted

Try here[^]
 
Share this answer
 
You should go there-[Authenticating Users with Windows Authentication][^] to learn how to authenticate user with windows authentication.
 
Share this answer
 
Comments
Uday P.Singh 28-Oct-11 5:47am    
my 5+ in fact I posted the same answer with different link.
RaviRanjanKr 1-Nov-11 3:04am    
Thanks Uday! :)
Perhaps you want to make your application to run on local intranet for limited users(with their windows credentials). For this you can go for windows authentication:

Windows Authentication Using Form Authentication[^]

hope it helps :)
 
Share this answer
 
use window authentication
+
checks
VB
Dim WinId As String = HttpContext.Current.User.Identity.Name
       user.Text = WinId.ToString
       Pass.Text = HttpContext.Current.User.Identity.IsAuthenticated.ToString
       Pass0.Text = HttpContext.Current.User.Identity.AuthenticationType

Check this code help you to which user is login and its is window authenticated or not.
 
Share this answer
 
i have used the VS login in tool in my webpage
then add the below into the webconfig
<connectionstrings>
    <remove name="LocalSqlServer"></remove>
    <add name="accconstr" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|DB.mdb" providername="System.Data.OleDb"></add>
    <add name="ADConnectionString" connectionstring="LDAP:SERVERNAME"></add>
  </connectionstrings>
  <system.web>
    <identity impersonate="true" username="AD ADMIN USERNAME" password="AD ADMIN PASSWORD"></identity>
    <membership defaultprovider="MembershipADProvider">
      <providers>
        <remove name="AspNetSqlMembershipProvider"></remove>
        <add connectionstringname="ADConnectionString" attributemapusername="sAMAccountName" name="MembershipADProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"></add>
      </providers>
    </membership>

</system.web>
<authentication mode="Forms">
      <forms loginUrl="login.aspx" protection="All" timeout="30" name="AppNameCookie" slidingExpiration="true" cookieless="UseCookies" enableCrossAppRedirects="false"/>
    </authentication>
    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>
 
Share this answer
 
v3
if you have an active directory, you can use use that to authenticate the users before they enter into you website.
let me know if you have Active Directory and the credentials to use that. maybe i can help you with the code as i had recently used it myself for a corporate intranet.
 
Share this answer
 
Comments
usernetwork 28-Oct-11 15:49pm    
can u share ur code here ...it will be very useful

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900