[Webinar] Streamline your web hosting managementRegister Today


Forms based Windows Authentication

Posted on 2008-11-13
Medium Priority
Last Modified: 2012-05-05
Currently i use windows authentication.  When a user goes to the site a popup box comes up asking for username and password.  Is there an wasy way to make this a form on a page instead?

I am currently using Visual Studio 2008 Express.
I am using VB
Question by:phoenixfire425
  • 4
  • 4

Expert Comment

by:Tristan Shortland
ID: 22950237
Create a page with a form which verifies some user credentials supplied by the user (there are prebuilt controls for this which will integrate with a users database very well built by MicroSoft, or you can build your own - textbox for username, one for password and a button is all it takes...).

*Then in web.config change authentication mode to forms where it currently says windows.*

You can use the ASP.NET configuration tool (Website -> ASP.NET Configuration) to manage users and roles, if you choose to use the Microsoft framework.

There's lot's of good info on google too...


Author Comment

ID: 22950326
When i try to use the control built into VS.net it does not find the user names from my active directory.

and if i create a form i am not sure how to pass the names and passwords to be authenticated.

Expert Comment

by:Tristan Shortland
ID: 22950858
When using forms authentication you aren't looking at active directory. Using the built in controls will point to a database of usernames/passwords/role information for users.

If you want to integrate with active directory then you will have to use Windows authentication.

You may be able to do something clever in the aplication to get the Windows username and password for that user then validate those against ones they have entered into a web form built by you...
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


Author Comment

ID: 22950893
That what i want to do.
Is have a form. but not form authentication.
The username and password are used from active directory.
So i guess it would be a kind of Mixed mode form?
any idea on how to do this?

Author Comment

ID: 22950938
Or ideally I would like to use windows authentication with a Form Based Logon Screen  

Author Comment

ID: 22950957
Thats in C# i need the VB type :(

Accepted Solution

Tristan Shortland earned 80 total points
ID: 22951027
You'll find that a lot with code examples on the net.
All .NET languages share the same framework so the differences are only syntactical.
Here is an example:

    string domainUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    string[] paramsLogin = domainUser.Split('\\');
    txtUser.Text = paramsLogin[1].ToString();
    txtDomain.Text = paramsLogin[0].ToString();

Translates to:

If Page.IsPostback() = False Then
    Dim domainUser As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name
    Dim paramsLogin As String() = domainUser.Split('\\')
    txtUser.Text = paramsLogin(1).ToString()
    txtDomain.Text = paramsLogin(0).ToString()
End If

There are also plenty of good converters.
I googled: use windows credentials for form authentication to get that link - try finding a VB.NET link down a similar route...

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question