views:

1196

answers:

4

How would I go about creating a web app login handler in C#?

In Java I would use a JSP that posts the username and password to a servlet, which then delegates to a POJO - for the db lookup and validation. If validation fails the servlet forwards onto the login.jsp for another attempt, if successfull then forwards to the secure resource.

+9  A: 

Look into Forms Authentication.

Jason Bunting
This is the cleanest method of them all.
Andrei Rinea
A: 

In asp.net web form model each page posts back to itself. create an function that is tied to a button click to do the db lookup and validation.

Here is an example in VB.net that can be easily converted to c# using a vb to c# converter:

http://www.sitepoint.com/article/securing-passwords-database/

Gthompson83
+1  A: 

Mainly, it's a terminology issue. Let me translate your Java to ASP.NET MVC:

In ASP.NET MVC, I would use an HTML view that posts the username and password to a Controller action, which then delegates to a POCO - for the db lookup and validation. If validation fails the Controller renders the Login view for another attempt, if successful then forwards to the secure resource.

And, to WebForms:

In ASP.NET WebForms, I would use a LoginControl that postbacks the username and password back to the Login.aspx codebehind, which then delegates to a POCO - for the db lookup and validation. If validation fails the Login.aspx page would be shown again for another attempt, if successful then redirects to the secure resource.

Mark Brackett
A: 

The .NET Web Site Administration Tool in Visual Studio is great for a first timer.

Sara Chipps
... suggesting Forms Authentication, right?
Andrei Rinea