I have an ASP.NET MVC site currently working with forms authentication.
I want to add the ability for some users to use a special link I send them, this link will grant them direct access to the site without having to login. Problem is, that even the call to my contoller still goes through the login page.
Any ideas on how to make this direct login without giving up on the forms authentication for all other users?
Related
I am attempting to build an ASP.NET MVC website which allows certain domain users to login and access the various functions it offers. I'm building this using Azure AD which Azure has a really nice way of letting you download a pre-built application which comes withe a Windows login page and authenticates the user already.
Here is the login page. It is even pre-populated with my domain.
Username#mydomain.com
After a successful login however the User.Identity.Name property is null.
I did some searching online and found a ton of posts like this that recommended turning Anonymous Authentication off and Windows Authentication on in the project properties. I gave that a shot but it automatically signs me in, completely bypassing the login page, and the User.Identity.Name is the name of the PC I'm developing this on. Is there a way to have Windows Authentication enabled and still have the login page working?
EDIT 1:
I forgot to mention, the User.Identity.Name property is null after the user has been authenticated for login.
I'm kinda new to .net development and in my company, they've been using forms authentication for a while. But as we wanted to use external login integration, I implemented from the Microsoft Documentation as given here.
Previously as my company was using Forms Authentication and my integration for external login being correct, I was redirected back to the login page after clicking for login with other providers.
So, I disabled authentication to None in my web.config and my external login with OWIN integration is working fine but now after Logging-in normally on my site it redirects me back to the login page and I'm not getting what's the issue or how can I get back both of them to work. I need a solution to get both forms and identity authentication to work or something that'll get my work done. I also got something to suppress default authentication but I'm unable to get it to work.
I'm developing a MVC application that will require a user to be authenticated against an AD. how to create log in page in MVC to create an Intranet Application that automatically authenticates a user against an AD
Why don't you use the Intranet Template provided by Microsoft Visual Studio, which does exactly what you want out of the box?
Your requirement is paradox. Why do you want a login page, which does login a user automatically, while being logged in by visiting the (main-)site automatically, does not require the visitor to do anything at all, because he is already authenticated by entering his credentials at the windows-logon
More information: http://msdn.microsoft.com/en-us/library/gg703322(v=vs.98).aspx
you can use the built in windows authentication feature. the example is in here
if you need mixed authenticated for example you want the user can access from outside using their AD it will involve either two applications or two different pages for authentication types. find the example here
I'm not entirely sure if you actually want a login page that automatically authenticates a user that visits the main site. Maybe your wording is a bit confusing there.
I'll asumme you want your Web-App to be able to authenticate users against AD after having to log in with intranet credentials. If that's the case, you might want to have a look at this article detailing how to set that up using IIS and an ASP.NET app.
If not, please disregard this answer.
i'm still new in asp.net.. i hv been assigned a task to verify login using C# ASP.NET with two Login button which is Login for members and Login for Admin..Can you help me on how to connect my dbo.users table field in database with below login code and give the status for the login either Active or not.
Asp.net provides various methods of authentication. It is usually best to select one of the existing authentication mechanisms.
In your case forms authentication would work best.
Asp.net provides a login control for this.
It has events you can hook on to do custom checking with own tables.
Here are a few links to get you started.
Forms authentication overview
Login controls
Asp.net membership
I would also to #nunespascal's answer that you wouldn't need two logins for users and admins if you used Forms Authentication as you could simply check to see which role the user was in after authentication. Then based on that you take whatever action is necessary.
I am building an intranet website. And I am still unsure of how to implement the security of the website. I am using ASP.NET MVC 3.
Anyone in the company can access the website. It is a recognition system where you can nominate an employee for an award. Currently I am not using any type of authentication. I have a roles table that contains roles and an association table that specifies which user contain what roles, these roles are mainly administrator-type roles. If a user does belong in these roles then he/she can still access various parts of the website.
Would I need to use the built-in membership for this? Or would I need to create a custom membership for this? We don't use a login page. If the user does not have roles to access a view then he/she is redirected to another page.
We use IIS to do our authentication. Is this the same as Windows authentication? I have the roles table used for authorisation.
I'm just a little confused at the moment, I am hoping someone can give me some more clarity.
You can very well use ASP.Net MembershipProvider and RoleProvider for this
For tutorials on how to use them you should look at Videos at asp.net.
Here's a walk-through at MSDN
This blog post by Scott Guthrie might help:
Recipe: Enabling Windows Authentication within an Intranet ASP.NET Web application
For Intranet web applications, the most common authentication scenario to use is called Windows Authentication. Windows Authentication avoids the need to create a login form within an application, and does not require end-users to manually enter their username/password credentials to login to the application. Instead, ASP.NET and IIS can automatically retrieve and validate the Windows username of the end-user visiting the site in a secure way