在C#中更改密码 [英] change password in C#

查看:76
本文介绍了在C#中更改密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要从具有三个文本框,一个旧密码,新密码并在c#中确认密码的数据库中更改密码.

i want to change password from database where i have three text box, one old password ,new password and confirm password in c#

推荐答案

请参见此处的语法 T-SQL更新语句 [
See here for the syntax of the T-SQL update statement[^]. Since you''ve not tagged your question properly I''ll just assume you''re using some sort of MS SQL Server.

Cheers!

--MRB


需要考虑的几点:

1)如果您对密码进行哈希处理,则需要首先检查现有密码是否匹配.您可能可以使用现有存储的proc来模拟登录并验证旧密码.

2)您可以先在客户端验证新密码,然后再将其发送到服务器.如果您使用的是ASP.NET,则可以使用多种技术(AJAX库包含用于执行此操作的RegEx控件,或者您可以轻松地使用jQuery来检查有效性).

3)使用其他推荐来源将新值推入表中.请记住,如果您的身份验证系统正在对密码进行哈希/加密,则可能需要先执行此操作(或调用适当的SP而不是使用自己编写的更新语句).

希望这会有所帮助!
Some points to consider:

1) If you''re hashing the password, you''ll want to first check to see if the existing one matches. You can likely use an existing stored proc to emulate a log-on and verify the old password.

2) You can verify the new password on the client side before sending it to the server. If you''re on ASP.NET there are a number of techniques for this (the AJAX library includes the RegEx controls to do this, or you can easily use jQuery to check for validity).

3) Use the other recommended source for pushing the new value into the table. Remember that if your authentication system is hashing/encrypting your passwords you may need to do this first (or call the appropriate SP rather than using an update statement you write on your own).

Hope this helps!


这篇关于在C#中更改密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆