嗨,PLZ我想保存注册用户名和密码...... [英] Hi, plz I want to save registering username and password ...

查看:95
本文介绍了嗨,PLZ我想保存注册用户名和密码......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码不保存用户注册的用户名和密码

我使用会话存储用户名,所以当我点击更改密码按钮时系统知道谁的密码。 .. ?? !!

请尽快回答



我的尝试:



受保护的子Button1_Click(ByVal sender As Object,ByVal e As System.EventArgs)处理Button1.Click

Dim con As New SqlConnection

Dim cmd As New SqlCommand(log1)

Dim ADD As New SqlDataAdapter

cmd.CommandType = CommandType.StoredProcedure

Dim ds As New DataSet

Dim dt As New DataTable

Dim str As String

Dim up as Byte

con.ConnectionString =Server = .; Database = log; User Id = sa; Password = 123;

cmd.Connection = con

ADD.SelectCommand = cmd

cmd.Parame ters.Add(@ Username,SqlDbType.VarChar)

cmd.Parameters(@ Username)。Value = TxtUser.Text

cmd.Parameters.Add( @ Password1,SqlDbType.VarChar)

cmd.Parameters(@ Password1)。Value = TxtPass.Text

con.Open()

ADD.Fill(ds,Tabel)

'Server.Transfer(login.aspx,True)

con.Close()

Session(loaddata)= ds.Tables(Tabel)

如果ds.Tables(Tabel)。行(0)(x)= 0那么

MsgBox(True)

'Server.Transfer(login.aspx,True)

'Response.Redirect(login .aspx)

Else

MsgBox(假)

结束如果

结束Sub

解决方案

即使该代码确实有效,它仍然是错误的!

绝不以明文形式存储密码 - 这是一个主要的安全风险。有关如何在此处执行此操作的信息:密码存储:如何做到这一点。 [ ^ ]代码在C#中。但它很明显,你可以使用 Code Converter |由Telerik提供 [ ^ ]以生成等效的VB代码。

This code don't save username and password register by the user
I use the session to store the username ,,so when i click on change password button the system know the password for who...??!!
plz answer as soon as possible

What I have tried:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand("log1")
Dim ADD As New SqlDataAdapter
cmd.CommandType = CommandType.StoredProcedure
Dim ds As New DataSet
Dim dt As New DataTable
Dim str As String
Dim up As Byte
con.ConnectionString = "Server=.;Database=log;User Id=sa; Password=123;"
cmd.Connection = con
ADD.SelectCommand = cmd
cmd.Parameters.Add("@Username", SqlDbType.VarChar)
cmd.Parameters("@Username").Value = TxtUser.Text
cmd.Parameters.Add("@Password1", SqlDbType.VarChar)
cmd.Parameters("@Password1").Value = TxtPass.Text
con.Open()
ADD.Fill(ds, "Tabel")
'Server.Transfer("login.aspx", True)
con.Close()
Session("loaddata") = ds.Tables("Tabel")
If ds.Tables("Tabel").Rows(0)("x") = 0 Then
MsgBox("True")
'Server.Transfer("login.aspx", True)
'Response.Redirect("login.aspx")
Else
MsgBox("False")
End If
End Sub

解决方案

Even if that code did work, it would still be wrong!
Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^] The code is in C#. but it's pretty obvious, and you can use Code Converter | Provided by Telerik[^] to generate the equivilent VB code.


这篇关于嗨,PLZ我想保存注册用户名和密码......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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