简体   繁体   中英

How to implement Login functionality using ASP.NET WebForms and existing SQL Server database?

I have a SQL Server database that I made using Visual Studio's LocalDB. It has 5 tables, one for the Employee information and credentials, one for the location codes of the offices of the company and others for the meetings he attended and the tasks assigned to him.

I am mainly looking to implement Login functionality on my WebApp. How do I access the SQL database and implement Login? I have currently connected the database and used ADO.NET Entity Model to access the database. I am looking to avoid stored procedures. It would be best if the someone explained how to do this with ADO.NET Entity Model and the Login control.

You have to create your own table with login credential{like username, password,role(if you want to set)}, then after just connect your table with the login template to check the credential.

These links will help you out:
http://www.c-sharpcorner.com/uploadfile/raj1979/login-control-in-Asp-Net-3-5/ http://www.aspsnippets.com/Articles/Simple-User-Login-Form-example-in-ASPNet.aspx

you can just use Membership class, install the required db objects via aspnet_regsql or automatically created if it does not exist by the framework. the Login control for example uses it internally by calling Membership.Validate(username, password) for example.

Otherwise, if you insist to use another data framework such as entity model then you may create your own table for storing users, roles etc. there should be plenty examples of this. You still can use the Login control and handle the event such as LoggingIn, LoggedIn to plug in your own codes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM