如何创建C#登录处理程序
时间:2020-03-06 14:41:13 来源:igfitidea点击:
我将如何在C#中创建Web应用程序登录处理程序?
在Java中,我将使用将用户名和密码发布到Servlet的JSP,然后将其委托给POJO进行db查找和验证。如果验证失败,则servlet将转发到login.jsp进行另一次尝试,如果成功,则将转发到安全资源。
解决方案
查看表单身份验证。
在asp.net Web表单模型中,每个页面都发回其自身。创建与单击按钮相关的函数,以执行数据库查找和验证。
这是VB.net中的一个示例,可以轻松转换为将vb锁定到cconverter:
http://www.sitepoint.com/article/securing-passwords-database/
主要是一个术语问题。让我将Java转换为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.
并且,对于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.
Visual Studio中的.NET网站管理工具非常适合第一次使用。