.Net Authentication and Authorization - asp.net

I have one third party web application developed in the ASP.Net. This web application shows some pdf planning data which comes from the the oracle database.
I have windows authentication defined on this application for authentication purpose. So whenever i first launch this application there is a popup comes up and ask for username and password like this.
I want to get rid this pop up and Instead of entering different username and password each time I want to use a single userid/password for all the hits to this web application. Because I do not want all users to have access to my database.
Please help. I want to use the single username and password without getting the login popup.

Here is the solution i got for my problem We need do the things to get rid of the login popup
Set the IIS authentication mode as windows and Use the Active directory authentication.
Add the web site as a trusted website in the internet properties.
In the internet properties allow automatically login with username and password. It will use your windows username and password and login you.

Related

Is Windows Authentication enough to sign my user in?

I have an ASP.NET Core application using Identity. It is an intranet application and I am requiring all users be authenticated using Windows Authentication, which uses Kerberos.
I want to have the system be seamless for the user, so that when they access the page and they are not signed in but are authenticated, they are automatically signed in using their User.Identity.Name which corresponds to their Identiy Username which I first check to see if exists with UserManager.FindByIdAsync
If it does exist, I sign them in using the SignInManager. If it doesn't exist, I create a new user in the Identity store and then sign that user in.
Is this assuming too much? is this potentially going to come back and bite me, or is this perfectly acceptable? Most examples I see exist with user credentials being transmitted to sign the user in to Active Directory.
With integrated authentication IIS becomes the point at which users login, and you don't need, and shouldn't use Identity 3.0 - you don't need it, AD is the user database here, you don't need to add Identity.
When you create a new application you should click the change authentication button in the new project dialog and choose Windows authentication. That will configure everything correctly and won't add any of the Identity pieces.
Note that in RC1 authorization based on role/AD group membership is broken, so Authorize[Roles = "MYDOMAIN\mygroup"] won't work. This will be fixed in RC2.

How to get current User Name in Silverlight application without asking user to login

I need to get current username of user who start silverlight application.
I was able to do it, when I get User.Identity.Name in aspx page and pass it to silverlight app.
But it requires windows authentication, so asks users to sign in with domain user(with same domain as iis server).
Is it possible to get windows username, without asking user to sign in, and get name even if user is in another domain?
It is not possible. You should use windows authentication within your service.

Get windows authenticated user name in .net app?

How to get windows authenticated user name in .net application? My app is hosted on IIS. There is no Login form. But, I want to get the windows user name of the persons browsing it. I tried all the request objects. principal object getcurrent().name returns IIS app pool user name. But not the actual user. Please help. Thanks.
You cannot. Unless your application is using windows auth (and they could be prompted at some point like in firefox) you cannot get this information. If you do allow it, then access it via http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx
HttpContext.User.Identity.Name
again though - they could be prompted for a login at some point.
You can't unless you enable windows authenication.

ASP.NET Form Authentication + NTLM + LDAP

I'm trying to add LDAP support to an existing ASP.NET website that uses Form Authentication. This is not a big problem, I just build a simple login dialog (ordinary HTTP POST), query the LDAP directory and log the user in via Form Authentication ticket.
It would be extremely nice to automatically get the users credentials via NTLM (Integrated Windows Authentication) without the need for a login dialog (like what you get when using ASP.NET Windows Authentication with computers in the same Active Directory). Is there an easy way to do this (keep in mind, I can't use Windows Authentication for my ASP.NET app and the server is not in an Active Directory Domain, I need to be able to query LDAP directory manually)? Or would I have to manually do all the LDAP handshaking / challenge/response thingy?
Thanks for your help,
~ saxx
I do just this on my intranet here. These are the steps I use...
Create a login page (login.aspx seems good) & set the web app up for forms authentication. Set authorisation as deny anonymous. These means any attempt to use your app will cause the user to be redirected to your login page if they don't have a auth ticket.
Now the important step. In IIS, set the app to allow anonymous only. On your login page change this to only be Windows Integrated. Now what happens is when the user is bounced to your login page, IIS forces an NTLM authentication. We now have the users name in the headers.
2nd important step. in the page_load method add:
FormsAuthentication.RedirectFromLoginPage(Request.ServerVariables["Logon_user"], false);
What this does is take the username IIS will always give us and put into a forms auth ticket.
There's of course a certain amount of tidying up you may want to do, perhaps adding a logout feature, or stripping the domain name of the username.
Simon

Is it possible to get the Windows logon name with site running asp.net forms authentication?

I have a website with a large user base configured with asp.net 2.0 forms authentication. Before the user logs in via forms authentication is it possible to retrieve the windows login name/user account name on the machine they are using?
Many thanks
It certainly is possible--by adding another web application to your system. Here's roughly how I have done it:
Your primary web app uses Forms authentication. On the forms login page, any user that is determined to be on the local LAN (check IP address), redirect them to another app that uses Windows authentication. In this second app, you can determine the user (assuming the browser is configured to send credentials automatically to the zone in which your app resides), then set a cookie which your first app can read, and redirect the user back to the original app.
This does work.
This would only be possible if you were using Windows Authentication in your web application and then only if the user had logged in.
The kind of information you are after is not sent as part of the web request (quite rightly) and is therefore unknown to the web server.
Unfortunately no - if the user has not logged on, they are browsing anonymously, and are therefore unknown to the server. There is no way to identify them.
Once they're logged on, if you're using impersonation use WindowsIdentity.GetCurrent().Name. However, for forms authentication there's no direct way to ask the browser for their Windows credentials as they may not even be running Windows!
Not BEFORE no (not from the server).
Depending on the type of Auth you use, though, and the way the site is configured, you CAN get them to log in with their windows details.
See Mixing Forms and Windows Security in ASP.NET on Microsoft's MSDN.
The main difference with #TheObjectGuy answer is that instead of using 2 websites, this does all in a single website by configuring IIS to use the Integrated Windows authentication just in a "single" page (WinLogin.aspx).

Resources